public void DoInteract(NSEstablishment.Establishment esta) { Context.FaceEstablishment(esta); //unit.onResponseFinished.AddListener(OnResponseReceived); esta.Respond(Context); Invoke("Finish", lagTime); }
public override bool TryInteract(NSEstablishment.Establishment est) { base.TryInteract(est); // TODO : Always know current block instead List <NSEstablishment.Establishment> adjacent = Context.block.GetAdjacentEstablishment(5); foreach (NSEstablishment.Establishment o in adjacent) { //TODO /REFACTOR // Do not move, just interact if (o == est) { DoInteract(est, 2f); return(true); } } return(false); }
public bool GetNeighbour(Vector3 direction, out Block neighbour, out NSEstablishment.Establishment establishment) { RaycastHit hit; Ray ray = new Ray(transform.position, direction); //TODO put layer elsewhere if (Physics.Raycast(ray, out hit, 2, NSGame.Resources.Instance.collisionLayerEstablishment)) { establishment = hit.collider.GetComponent <ColliderData>().owner.GetComponent <NSEstablishment.Establishment>(); neighbour = null; return(true); } else if (Physics.Raycast(ray, out hit, 2, NSGame.Resources.Instance.collisionLayerBlock)) { neighbour = hit.collider.GetComponent <BlockColliderData>().block; establishment = null; return(true); } neighbour = null; establishment = null; return(false); //Vector3 halfExtents = new Vector3(0.25f, 1, 0.25f); //Collider[] colliders = Physics.OverlapBox(transform.position + direction, halfExtents); //if (colliders.Length > 0) //{ // neighbour = colliders[0].GetComponent<BlockColliderData>().block; // return true; //} //neighbour = null; //return false; }
public void DoInteract(NSEstablishment.Establishment est, float delayTime) { //yield return new WaitForSeconds(delayTime); Context.fsm.SwitchState("Interact", est.gameObject, Context.block.gameObject); }
// Overriden public virtual bool TryInteract(NSEstablishment.Establishment est) { // NOthing return(false); }