base for pick and throw

This commit is contained in:
Glence 2022-11-02 00:25:43 +08:00
parent 97a39d62c6
commit 4eef6143dc
2 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1,30 @@
using SHADE;
using System;
using static PlayerController;
public class PickAndThrow : Script
{
private PlayerController pc;
public uint itemEID;
Transform itemHoldLocation;
public PickAndThrow(GameObject gameObj) : base(gameObj) { }
protected override void awake()
{
pc = GetScript<PlayerController>();
itemHoldLocation = GetComponentInChildren<Transform>();
}
protected override void update()
{
if (pc != null && pc.holdItem)
{
}
}
protected override void onCollisionEnter(CollisionInfo info)
{
if (info.GameObject.Name == "item" && Input.GetKey(Input.KeyCode.E))
{
pc.holdItem = true;
itemEID = info.GameObject.EntityId;
}
}
}

View File

@ -22,6 +22,7 @@ public class PlayerController : Script
//to be remove
public float drag = 2.0f;
public bool holdItem = false;
[SerializeField]
[Tooltip("The current state fo the raccoon")]
public RaccoonStates currentState = RaccoonStates.IDILE;