Skip to content

Commit

Permalink
tweaks to pickup action
Browse files Browse the repository at this point in the history
  • Loading branch information
MisterSquishy committed May 22, 2018
1 parent 553454d commit 5894de3
Show file tree
Hide file tree
Showing 19 changed files with 110 additions and 82 deletions.
11 changes: 10 additions & 1 deletion Assets/Exciting_Object.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,32 @@ public class Exciting_Object : MonoBehaviour
public bool CanBePickedUp = false;
public bool CanBeChewed = false;
public bool IsInMouth = false;
private SpriteRenderer playerRenderer;
private SpriteRenderer objectRenderer;

// Use this for initialization
void Start()
{

playerRenderer = Character_Manager.GetPlayer().GetComponent<SpriteRenderer>();
objectRenderer = GetComponent<SpriteRenderer>();
}

// Update is called once per frame
void Update()
{
if (IsInMouth)
{
objectRenderer = this.gameObject.GetComponent<SpriteRenderer>();
objectRenderer.sortingOrder = playerRenderer.sortingOrder + 1;
GameObject _character = null;
_character = Character_Manager.GetClosestCharacterTypeWithRawTransform(this.transform, CharacterType.Scout, _character, float.PositiveInfinity);
// Move the actual character of this gameobject closer to _character gameobject.
this.transform.position = _character.transform.GetChild(0).position; //get the actual scout, not the scout manager
}
else
{
objectRenderer.sortingOrder = playerRenderer.sortingOrder - 1;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ OcclusionCullingSettings:
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 8
serializedVersion: 9
m_Fog: 0
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3
Expand All @@ -39,6 +39,7 @@ RenderSettings:
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
Expand All @@ -54,11 +55,10 @@ LightmapSettings:
m_EnableBakedLightmaps: 0
m_EnableRealtimeLightmaps: 0
m_LightmapEditorSettings:
serializedVersion: 9
serializedVersion: 10
m_Resolution: 2
m_BakeResolution: 40
m_TextureWidth: 1024
m_TextureHeight: 1024
m_AtlasSize: 1024
m_AO: 0
m_AOMaxDistance: 1
m_CompAOExponent: 0
Expand Down Expand Up @@ -2328,7 +2328,7 @@ MonoBehaviour:
- Name: Demo Start
BGMusic: {fileID: 0}
- Name: MainMenu
BGMusic: {fileID: 8300000, guid: 92ea0b63796166e40a2e9eaa44fd1b36, type: 3}
BGMusic: {fileID: 8300000, guid: d0b0000c821593a499762febe7cfd438, type: 3}
- Name: MainWorld
BGMusic: {fileID: 8300000, guid: d0b0000c821593a499762febe7cfd438, type: 3}
- Name: HouseMd
Expand All @@ -2338,7 +2338,7 @@ MonoBehaviour:
- Name: HouseSml
BGMusic: {fileID: 8300000, guid: d0b0000c821593a499762febe7cfd438, type: 3}
- Name: InnBasement
BGMusic: {fileID: 8300000, guid: fccceda32c2a65445ac8429fd88af36e, type: 3}
BGMusic: {fileID: 8300000, guid: d0b0000c821593a499762febe7cfd438, type: 3}
--- !u!114 &827076141
MonoBehaviour:
m_ObjectHideFlags: 0
Expand All @@ -2351,7 +2351,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
bgMusicSource: {fileID: 827076142}
musicOn: 1
musicOn: 0
sfxOn: 1
sfxVolume: 0.5
--- !u!82 &827076142
Expand All @@ -2360,15 +2360,15 @@ AudioSource:
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 827076138}
m_Enabled: 0
m_Enabled: 1
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 0}
m_audioClip: {fileID: 0}
m_PlayOnAwake: 0
m_Volume: 0.5
m_Pitch: 1
Loop: 1
Mute: 0
Mute: 1
Spatialize: 0
SpatializePostEffects: 0
Priority: 128
Expand All @@ -2383,54 +2383,69 @@ AudioSource:
rolloffCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 2
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
- serializedVersion: 2
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
panLevelCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 2
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 0
spreadCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 2
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 0
reverbZoneMixCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 2
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ void OnEnable(){
Item weapon = equipment.GetWeapon ();
// Get the sprite renderer of the this weapon.
weaponRenderer = GetComponent<SpriteRenderer> ();
// Get the Sprite Image of the weapon and set it to this GameObject's Sprite.
weaponRenderer.sprite = weapon.SpriteImage;
// Set the coloring of the Sprite renderer.
weaponRenderer.color = new Color (weapon.R, weapon.G, weapon.B, weapon.A);
if (weapon != null)
{
weaponRenderer.sprite = weapon.SpriteImage;
weaponRenderer.color = new Color(weapon.R, weapon.G, weapon.B, weapon.A);
}
}

void Update(){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,33 +75,10 @@ void Update(){
LoadStatsFromItems();
// Make the player look at the NPC it is interacting with.
PlayerLookDirection();
// IF the InteractionKey is the same as the AttackKey. (In this case, interaction has a higher priority than attacking.)
if (InteractionKey == AttackKey) {
// IF we pressed the Interaction Key.
if (Input.GetKeyDown (InteractionKey)) {
// IF we are close enough to an Action Key Dialogue component.
if(DialogueInteraction()){
// Create the dialogue with the closest GameObject with an Action Key Dialogue.
ClosestAKD.CreateDialogue ();
// This is what we are focusing on now so lets return.
return;
}
// IF there is an Animator on the player AND we actually have a weapon to attack with.
if (CharacterAnimator != null && equipment.GetWeapon() != null) {
// ATTACK!!!
Attack ("IsAttacking", AttackSound);
}
return;
}
}

// IF we pressed the Attack Key.
if (Input.GetKeyDown (AttackKey)) {
// IF there is an Animator on the player AND we actually have a weapon to attack with.
if (CharacterAnimator != null && equipment.GetWeapon() != null) {
// ATTACK!!!
Attack ("IsAttacking", AttackSound);
}
if (Input.GetKeyDown (InteractionKey) && DialogueInteraction()) {
ClosestAKD.CreateDialogue ();
} else if (Input.GetKeyDown (AttackKey) && CharacterAnimator != null) {
Attack ("IsAttacking", AttackSound);
}
}

Expand All @@ -118,10 +95,6 @@ public void Attack(string animationNameValue, AudioClip clip){
CharacterAnimator.SetBool (animationNameValue, true);
// Play the attack sound (if there is one).
Grid.soundManager.PlaySound (clip);
// Set the IsMoving variable for the animation to false since the character will not be moving while attacking. (Personal choice)
CharacterAnimator.SetBool ("IsMoving", false);
// Make it to where the player cannot move. (Personal choice)
CanMove = false;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ MonoBehaviour:
ClosestAKD: {fileID: 0}
ListOfAreaDialogues: []
ListOfActionKeyDialogues: []
AttackSound: {fileID: 8300000, guid: ffb653f55b24903438856f1860866777, type: 3}
AttackSound: {fileID: 8300000, guid: 0fae3e787ea28ea4b8ccdd0306dd8b66, type: 3}
--- !u!114 &11446050
MonoBehaviour:
m_ObjectHideFlags: 1
Expand Down Expand Up @@ -285,6 +285,7 @@ SpriteRenderer:
m_MotionVectors: 1
m_LightProbeUsage: 0
m_ReflectionProbeUsage: 0
m_RenderingLayerMask: 4294967295
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
Expand Down Expand Up @@ -329,6 +330,7 @@ SpriteRenderer:
m_MotionVectors: 1
m_LightProbeUsage: 0
m_ReflectionProbeUsage: 0
m_RenderingLayerMask: 4294967295
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
Expand Down Expand Up @@ -541,6 +543,7 @@ Animator:
m_WarningMessage:
m_HasTransformHierarchy: 1
m_AllowConstantClipSamplingOptimization: 1
m_KeepAnimatorControllerStateOnDisable: 0
--- !u!114 &114000010606595590
MonoBehaviour:
m_ObjectHideFlags: 1
Expand Down Expand Up @@ -696,6 +699,7 @@ SpriteRenderer:
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 4294967295
m_Materials:
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
Expand Down
Loading

0 comments on commit 5894de3

Please sign in to comment.