Scripting changes for item and added level 1 scene #330
|
@ -95,6 +95,9 @@ public partial class LeafAttack : BehaviourTreeNode
|
|||
//Catch player when in range for long enough
|
||||
//Debug.Log("Success: Caught");
|
||||
player.GetScript<PlayerController>().currentState = PlayerController.RaccoonStates.CAUGHT;
|
||||
if (player.GetScript<PlayerController>().stateMachine && !player.GetScript<PlayerController>().stateMachine.IsState(typeof(PlayerCaughtState)))
|
||||
player.GetScript<PlayerController>().stateMachine.SetState(typeof(PlayerCaughtState));
|
||||
|
||||
status = BehaviourTreeNodeStatus.SUCCESS;
|
||||
onExit(BehaviourTreeNodeStatus.SUCCESS);
|
||||
return status;
|
||||
|
|
|
@ -49,6 +49,11 @@ public class Item : Script
|
|||
Audio.PlaySFXOnce2D("event:/Props/impact_hard");
|
||||
playSound = false;
|
||||
}
|
||||
|
||||
if (info.GameObject.GetScript<Homeowner1>())
|
||||
{
|
||||
returnBack = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void onCollisionExit(CollisionInfo info)
|
||||
|
|
|
@ -117,13 +117,6 @@ public class PickAndThrow : Script
|
|||
RetrieveItemComponets();
|
||||
}
|
||||
}
|
||||
|
||||
if (pc.currentState == RaccoonStates.CAUGHT && itemScript)
|
||||
{
|
||||
itemScript.returnBack = true;
|
||||
pc.holdItem = true;
|
||||
ResetItemObject();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void fixedUpdate()
|
||||
|
@ -230,7 +223,6 @@ public class PickAndThrow : Script
|
|||
return false;
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ public class PlayerController : Script
|
|||
public Camera cam { get; set; }
|
||||
public CameraArm camArm { get; set; }
|
||||
private PickAndThrow pat;
|
||||
private StateMachine stateMachine;
|
||||
public StateMachine stateMachine;
|
||||
|
||||
public bool holdItem { get; set; }
|
||||
public bool isAiming { get; set; }
|
||||
|
@ -370,6 +370,13 @@ public class PlayerController : Script
|
|||
if (stateMachine && !stateMachine.IsState(typeof(PlayerIdleState)))
|
||||
stateMachine.SetState(typeof(PlayerIdleState));
|
||||
tranform.LocalPosition = respawnPoint.GetComponent<Transform>().LocalPosition;
|
||||
|
||||
if (pat && pat.item.GetScript<Item>())
|
||||
{
|
||||
holdItem = false;
|
||||
isAiming = false;
|
||||
pat.item.GetScript<Item>().returnBack = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue