示例#1
0
    public void UpdatePlayer(InputManager.InputPkg pkg)
    {
        //If the player is initialize
        if (initialize == true)
        {
            //If the player is local
            if (!isLocalPlayer)
            {
                return;
            }
            //get the package from the inputManager



            if (pkg.objectSelected != null)
            {
                co.CmdDebug(id, name);


                if (currentMode == CurrentMode.STANDBY && Movements.CanSelectUnit(pkg.objectSelected, phase))
                {
                }
                else if (currentMode == CurrentMode.CREATE)
                {
                    if (pkg.objectSelected.tag == "IntersectionCollider")
                    {
                        co.CmdspawnUnit(pkg.objectSelected.GetComponentInParent <Intersection>().arrayPos, id, UnitType.Bit);
                        GridManager.Instance.DeactivateLight(Movements.posActiver);
                        currentMode = CurrentMode.STANDBY;
                        NextPhase();
                    }
                }

                else if (currentMode == CurrentMode.MOVE)
                {
                    if (pkg.objectSelected.tag == "IntersectionCollider")
                    {
                        Vector2 pos = Movements.LastObjetSelectionne.GetComponent <BasePawnsClass>().positionInGridArray;
                        Vector2 des = pkg.objectSelected.transform.parent.gameObject.GetComponent <Intersection>().arrayPos;

                        co.CmdMoveUnit(id, pos, des);
                        GridManager.Instance.DeactivateLight(Movements.posActiver);
                        currentMode = CurrentMode.STANDBY;
                        NextPhase();
                    }
                }
            }



            //Update each phase
            if (phase == KERNELPHASE)
            {
            }
            else if (phase == MOVEPHASE)
            {
            }
            else if (phase == TERRITORYPHASE)
            {
                UpdatePhase3(pkg);
            }
        }
    }