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)); }
// Start is called before the first frame update void Start() { //Debug.Log("starting at moveUnit"); if (hexa == null) { hexa = Hexasphere.GetInstance("Hexasphere"); } if (thisUnit == null) { thisUnit = gameObject.GetComponent <Unit>(); } if (autoMove == null) { autoMove = gameObject.GetComponent <autoMovement>(); } //currentTile = thisUnit.currentTile; }