Esempio n. 1
0
 void Start()
 {
     if (selfAuto == null)
     {
         selfAuto = GetComponent <autoMovement>();
     }
     if (selfMove == null)
     {
         selfMove = GetComponent <MoveUnit>();
     }
     if (selfSend == null)
     {
         selfSend = GetComponent <sendUnit>();
     }
     if (hexa == null)
     {
         hexa = Hexasphere.GetInstance("Hexasphere");
     }
     //set height adjustment to keep object flush with surface
     heightAdjust = GetComponent <Renderer>().bounds.size.y;
     //get current tile at position, parent and set object alignment
     currentTile = hexa.GetTileAtLocalPos(transform.position);
     //hexa.ParentAndAlignToTile(gameObject, currentTile, heightAdjust, true, false, 1);
     //set initial state as idle
     stateMachine.ChangeState(new Idle(this));
 }
Esempio n. 2
0
    public IEnumerator startMove()
    {
        CoroutineWithData cd = new CoroutineWithData(this, spawn());

        yield return(cd.coroutine);

        GameObject spawnedRobot = cd.result as GameObject;
        sendUnit   thisSendUnit = spawnedRobot.GetComponent <sendUnit>();

        thisSendUnit.destinationTransform = destination;
        thisSendUnit.startingTransform    = start;
        thisSendUnit.initiate();
    }