Пример #1
0
    //---------------------------------------------------------------

    /*
     *  @brief      オブジェクトから外す
     */
    //---------------------------------------------------------------
    public void RemoveObject()
    {
        attachedObject = null;
        objScript      = null;

        transform.parent = null;
    }
Пример #2
0
    void Awake()
    {
        attachedObject = null;
        objScript      = null;
        m_state        = EItemUseState.ITEM_STAT_READY;

        m_type       = GameDefine.ITEM_TYPE.ITEM_TYPE_INVALID;
        m_useType    = 0;
        m_reloadTime = 0;
        elapsedTime  = 0.0f;
    }
Пример #3
0
    //---------------------------------------------------------------

    /*
     *  @brief      オブジェクトへのアタッチ
     */
    //---------------------------------------------------------------
    public void AttachObject(GameObject target)
    {
        if (attachedObject || !target)
        {
            return;
        }
        attachedObject = target;
        objScript      = attachedObject.GetComponent <CharAction>();

        transform.parent = target.transform;
    }
Пример #4
0
 // Start is called before the first frame update
 void Start()
 {
     foreach (Transform child in transform)
     {
         if (child.TryGetComponent(out EventCollider eventcollider))
         {
             _event = eventcollider;
             break;
         }
     }
     _move   = gameObject.GetComponent <CharController>();
     _action = GetComponent <CharAction>();
     _state  = CharState.NOMAL;
     _action.Play();
 }
Пример #5
0
 // Use this for initialization
 void Start()
 {
     team = GameObject.FindGameObjectsWithTag("Player");
     if (team.Length == 0)
     {
         Debug.Log("NO TEAM FOR PLAYER");
     }
     else
     {
         member                = 0;
         selected              = team[member];
         this.ActionAccessor   = CharAction.MOVING;
         moveSelected          = selected.GetComponent <Movable>();
         moveSelected.Selected = true;
     }
 }
Пример #6
0
 public void SetDefaultAnimation()
 {
     if (myAnimator != null)
     {
         if (DefaultAnimationActionPrefab != null)
         {
             CharAction defaultAnimationAction = Instantiate(DefaultAnimationActionPrefab, new Vector3(0f, 0f, 0f), Quaternion.identity) as CharAction;
             defaultAnimationAction.transform.SetParent(transform, false);
             defaultAnimationAction.MyAnimator = myAnimator;
             defaultAnimationAction.MakeAction();
         }
         else
         {
             AnimationUtilities.SetTriggerIfExists("Idle", myAnimator);
         }
     }
 }
Пример #7
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Alpha1))
        {
            if (0 < team.Length)
            {
                moveSelected.Selected = false;
                selected              = team[0];
                moveSelected          = selected.GetComponent <Movable>();
                moveSelected.Selected = true;
                member = 0;
            }
        }

        if (Input.GetKeyDown(KeyCode.Alpha2))
        {
            if (1 < team.Length)
            {
                moveSelected.Selected = false;
                selected              = team[1];
                moveSelected          = selected.GetComponent <Movable>();
                moveSelected.Selected = true;
                member = 1;
            }
        }

        if (Input.GetKeyDown(KeyCode.Alpha3))
        {
            if (2 < team.Length)
            {
                moveSelected.Selected = false;
                selected              = team[2];
                moveSelected          = selected.GetComponent <Movable>();
                moveSelected.Selected = true;
                member = 2;
            }
        }

        if (Input.GetKeyDown(KeyCode.Alpha4))
        {
            if (3 < team.Length)
            {
                moveSelected.Selected = false;
                selected              = team[3];
                moveSelected          = selected.GetComponent <Movable>();
                moveSelected.Selected = true;
                member = 3;
            }
        }

        string hitName = "";

        if (Input.GetKeyDown(KeyCode.Return))
        {
            this.ActionAccessor = CharAction.ATTACKING;

            for (int i = 0; i < selected.transform.childCount; i++)
            {
                GameObject   square       = selected.transform.GetChild(i).gameObject;
                MeshRenderer meshRenderer = square.GetComponent <MeshRenderer>();
                meshRenderer.material = attackTile;
            }
        }
        if (Input.GetKeyDown(KeyCode.Space))
        {
            this.ActionAccessor = CharAction.DODGING;

            for (int i = 0; i < selected.transform.childCount; i++)
            {
                GameObject   square       = selected.transform.GetChild(i).gameObject;
                MeshRenderer meshRenderer = square.GetComponent <MeshRenderer>();
                meshRenderer.material = dodgeTile;
            }
        }
        if (Input.GetKeyDown(KeyCode.Backspace))
        {
            this.ActionAccessor = CharAction.MOVING;

            for (int i = 0; i < selected.transform.childCount; i++)
            {
                GameObject   square       = selected.transform.GetChild(i).gameObject;
                MeshRenderer meshRenderer = square.GetComponent <MeshRenderer>();
                meshRenderer.material = moveTile;
            }
        }

        if (Input.GetMouseButtonDown(0))
        {
            Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;
            if (Physics.Raycast(ray, out hit))
            {
                hitName = hit.transform.name;
            }
        }
        if (Input.GetKeyDown(KeyCode.W) || hitName == "Up_Move")
        {
            if (this.ActionAccessor == CharAction.MOVING)
            {
                if (moveSelected.moveUp())
                {
                    moveSelected.Selected = false;
                    selected = nextMember();
                }
            }
            else if (this.ActionAccessor == CharAction.ATTACKING)
            {
            }
        }
        else if (Input.GetKeyDown(KeyCode.S) || hitName == "Down_Move")
        {
            if (this.ActionAccessor == CharAction.MOVING)
            {
                if (moveSelected.moveDown())
                {
                    moveSelected.Selected = false;
                    selected = nextMember();
                }
            }
            else if (this.ActionAccessor == CharAction.ATTACKING)
            {
            }
        }
        else if (Input.GetKeyDown(KeyCode.A) || hitName == "Left_Move")
        {
            if (this.ActionAccessor == CharAction.MOVING)
            {
                if (moveSelected.moveLeft())
                {
                    moveSelected.Selected = false;
                    selected = nextMember();
                }
            }
            else if (this.ActionAccessor == CharAction.ATTACKING)
            {
            }
        }
        else if (Input.GetKeyDown(KeyCode.D) || hitName == "Right_Move")
        {
            if (this.ActionAccessor == CharAction.MOVING)
            {
                if (moveSelected.moveRight())
                {
                    moveSelected.Selected = false;
                    selected = nextMember();
                }
            }
            else if (this.ActionAccessor == CharAction.ATTACKING)
            {
            }
        }
    }
Пример #8
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Q)) //#Temporario
        {
            //When a key is pressed down it see if it was the escape key if it was it will execute the code
            Application.Quit(); // Quits the game
        }

        if (_battleStates.Equals(GameStateCtrl.BattleStates.StartTurn))
        {
            _battleStates = GameStateCtrl.BattleStates.SelectActor;
        }

        if (_battleStates.Equals(GameStateCtrl.BattleStates.SelectActor))
        {
            if (_isBackOption)
            {
                _countSelectedTgtActs = selectedTargetActions.Count;

                if (_countSelectedTgtActs > 0)
                {
                    _battleStates = GameStateCtrl.BattleStates.SelectTarget;
                    DeactiveObjButtons(_objCharBts);
                    _isActiveObjButton = false;

                    _clickedCharButton   = selectedTargetActions.Peek().ObjChar;
                    _clickedActionButton = selectedTargetActions.Peek().ObjAction;
                    _clickedTargetButton = selectedTargetActions.Peek().ObjTarget;
                    selectedTargetActions.Pop();
                    orderedTargets.RemoveAt(orderedTargets.Count - 1);
                }
                _isBackOption = false;
            }
            else
            {
                if (!_isActiveObjButton)
                {
                    ActiveObjCharButtons(_objCharBtns);
                    _isActiveObjButton = true;
                    _clickedCharButton = null;
                }

                if (SelectCharButton(_clickedCharButton) && _isActiveObjButton)
                {
                    DeactiveObjButtons(_objCharBts);
                    _isActiveObjButton = false;
                    _battleStates      = GameStateCtrl.BattleStates.SelectAction;
                }
            }
        }

        if (_battleStates.Equals(GameStateCtrl.BattleStates.SelectAction))
        {
            if (_isBackOption)
            {
                _battleStates = GameStateCtrl.BattleStates.SelectActor;
                DeactiveObjButtons(_objActionBts);
                DelectCharButton(_clickedCharButton);
                _isBackOption      = false;
                _isActiveObjButton = false;
            }
            else
            {
                if (!_isActiveObjButton)
                {
                    SetActionCharBt(_clickedCharButton);
                    ActiveObjButtons(_objActionBts);
                    _isActiveObjButton   = true;
                    _clickedActionButton = null;
                }

                if (_clickedActionButton != null && _isActiveObjButton)
                {
                    DeactiveObjButtons(_objActionBts);
                    _isActiveObjButton = false;
                    _battleStates      = GameStateCtrl.BattleStates.SelectTarget;
                }
            }
        }

        if (_battleStates.Equals(GameStateCtrl.BattleStates.SelectTarget))
        {
            if (_isBackOption)
            {
                _battleStates = GameStateCtrl.BattleStates.SelectAction;
                DeactiveObjButtons(_objTargetCharBts);
                DeactiveObjButtons(_objTargetEnemBts);
                _isBackOption      = false;
                _isActiveObjButton = false;
            }
            else
            {
                if (!_isActiveObjButton)
                {
                    ActiveObjButtons(_objTargetEnemBts);
                    _isActiveObjButton   = true;
                    _clickedTargetButton = null;
                }

                if (Input.GetKeyDown(KeyCode.RightArrow))
                {
                    ActiveObjButtons(_objTargetCharBts);
                    DeactiveObjButtons(_objTargetEnemBts);
                }
                else if (Input.GetKeyDown(KeyCode.LeftArrow))
                {
                    ActiveObjButtons(_objTargetEnemBts);
                    DeactiveObjButtons(_objTargetCharBts);
                }

                if (_clickedTargetButton != null && _isActiveObjButton)
                {
                    DeactiveObjButtons(_objTargetCharBts);
                    DeactiveObjButtons(_objTargetEnemBts);
                    _isActiveObjButton = false;

                    _battleStates = GameStateCtrl.BattleStates.BattlePhase;

                    _charAction = new CharAction(_clickedTargetButton, _clickedCharButton, _clickedActionButton);
                    selectedTargetActions.Push(_charAction);

                    orderedTargets.Add(_charAction.TargetName);

                    foreach (var charBtn in _objCharBtns)
                    {
                        if (!charBtn.Value)
                        {
                            _battleStates = GameStateCtrl.BattleStates.SelectActor;
                        }
                    }
                }
            }
        }

        if (_battleStates.Equals(GameStateCtrl.BattleStates.BattlePhase))
        {
            if (!_isActiveObjButton)
            {
                foreach (CharAction targetAction in selectedTargetActions)
                {
                    actionSortManager.AddAction(targetAction.TargetName, targetAction.CharName, targetAction.ActionName);
                }
                selectedTargetActions.Pop();
                _isActiveObjButton = true;

                ////#Pendente vai haver um passo aqui no meio onde o ActionSortManager vai com as chaves buscar as informações de ataque e etc

                foreach (string target in orderedTargets)
                {
                    Debug.Log(target);
                }

                foreach (string target in orderedTargets)
                {
                    actionSortManager.PrintActions(target); //#Temporario
                }
            }
        }
        else
        {
            if (Input.GetKeyDown(KeyCode.B)) //#Temporario
            {
                Debug.Log(_battleStates);
                _isBackOption = true;
            }
        }

        if (Input.GetKeyDown(KeyCode.T)) //#Temporario
        {
        }

        if (Input.GetKeyDown(KeyCode.S)) //#Temporario
        {
            Debug.Log(_battleStates);
        }

        if (Input.GetKeyDown(KeyCode.P)) //#Temporario
        {
        }
    }
Пример #9
0
 public void SetAction(CharAction a)
 {
     if (a != null) {
         action = a;
         op = OP.plan;
     }
 }
Пример #10
0
 public IEnumerator YieldReturn(CharAction caction)
 {
     yield return 0;
     rfunc(caction);
 }