Exemple #1
0
        public void DoInteract(NSEstablishment.Establishment esta)
        {
            Context.FaceEstablishment(esta);

            //unit.onResponseFinished.AddListener(OnResponseReceived);
            esta.Respond(Context);
            Invoke("Finish", lagTime);
        }
Exemple #2
0
        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);
        }
Exemple #3
0
        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;
        }
Exemple #4
0
 public void DoInteract(NSEstablishment.Establishment est, float delayTime)
 {
     //yield return new WaitForSeconds(delayTime);
     Context.fsm.SwitchState("Interact", est.gameObject, Context.block.gameObject);
 }
Exemple #5
0
 // Overriden
 public virtual bool TryInteract(NSEstablishment.Establishment est)
 {
     // NOthing
     return(false);
 }