예제 #1
0
    void Update()
    {
        if (Turn.GetCurrentTurnType() == TurnType.RegularGame)
        {
            if (Input.GetMouseButtonDown(0))
            {
                HandleAction();
            }

            if (IsActive() && Input.GetKeyDown(KeyCode.P))
            {
                SkipTurn();
            }

            if (Input.GetKeyDown(KeyCode.Space) && !_designerModeOn)
            {
                _designerModeOn = true;

                Mesh[] myMesh = new Mesh[6];

                DestroyImmediate(gameObject.GetComponent <SkeletonAnimation>());
                DestroyImmediate(gameObject.GetComponent <MeshFilter>());
                DestroyImmediate(gameObject.GetComponent <MeshRenderer>());
                _unitAnimations.BlockAnimations();
                _sprite = gameObject.AddComponent <SpriteRenderer>();

                if (GetStatistics().team == 1)
                {
                    _sprite.sprite = unitData.unitSpriteTeam1;
                }
                else
                {
                    _sprite.sprite = unitData.unitSpriteTeam2;
                }

                transform.localScale = Vector3.one;

                if (_combatLog.transform.position.y != _combatLog.GetLogYPosition())
                {
                    _combatLog.transform.position = new Vector3(_combatLog.transform.position.x,
                                                                _combatLog.GetLogYPosition(), _combatLog.transform.position.z);
                }
            }

            HandleHoveringUnit();
            HandleCursor();
        }
    }