示例#1
0
        public void RotateTowardCursor(ref Vector3 joystickCursor, ref ControllableUnit currentUnit)
        {
            float tmp = joystickCursor.y;

            joystickCursor.y = currentUnit.transform.position.y;
            currentUnit.transform.LookAt(joystickCursor);
            joystickCursor.y = tmp;
        }
示例#2
0
        public void MouseRotate(ref ControllableUnit currentUnit)
        {
            Vector3 tmp;

            rayCast.PlaneRayCast(out tmp);
            tmp.y = currentUnit.transform.position.y;
            currentUnit.transform.LookAt(tmp);
        }
示例#3
0
 public void StickRotate(ref ControllableUnit currentUnit)
 {
     if (Input.GetAxis("Rotation X") != 0f || Input.GetAxis("Rotation Y") != 0f)
     {
         currentUnit.transform.eulerAngles = new Vector3(
             currentUnit.transform.eulerAngles.x,
             Mathf.Atan2(Input.GetAxis("Rotation X"), Input.GetAxis("Rotation Y")) * Mathf.Rad2Deg,
             currentUnit.transform.eulerAngles.z);
     }
 }
示例#4
0
        private void SwitchUnit(int index)
        {
            units[index].transform.position = currentUnit.transform.position;
            units[index].transform.rotation = currentUnit.transform.rotation;
            units[index].gameObject.SetActive(true);
            playerUnits.items[0] = units[index];
            currentUnit.gameObject.SetActive(false);
            currentUnit     = units[index];
            currentAnimator = currentUnit.GetComponentInChildren <Animator>();
            //Animation

            EncounterController.instance.activeHero = currentUnit;
            GetComponent <CameraController>().UpdateTarget(currentUnit.gameObject);

            spellCasting.CancelCast();
            spellCasting.UpdateSpellBook(ref currentUnit.spellBook);
        }
示例#5
0
 public void OrderUpdate(ref ControllableUnit currentUnit)
 {
     if (Input.GetAxisRaw("Order 1") > 0f)
     {
         currentUnit.ChangeOrder(ControllableUnit.OrderType.None);
     }
     if (Input.GetAxisRaw("Order 2") < 0f)
     {
         currentUnit.ChangeOrder(ControllableUnit.OrderType.Def);
     }
     if (Input.GetAxisRaw("Order 3") > 0f)
     {
         currentUnit.ChangeOrder(ControllableUnit.OrderType.Atk);
     }
     if (Input.GetAxisRaw("Order 4") < 0f)
     {
         currentUnit.ChangeOrder(ControllableUnit.OrderType.Reg);
     }
 }
示例#6
0
 public void OrderUpdate(ref ControllableUnit currentUnit)
 {
     if (Input.GetButtonDown("Order 1"))
     {
         currentUnit.ChangeOrder(ControllableUnit.OrderType.None);
     }
     if (Input.GetButtonDown("Order 2"))
     {
         currentUnit.ChangeOrder(ControllableUnit.OrderType.Def);
     }
     if (Input.GetButtonDown("Order 3"))
     {
         currentUnit.ChangeOrder(ControllableUnit.OrderType.Atk);
     }
     if (Input.GetButtonDown("Order 4"))
     {
         currentUnit.ChangeOrder(ControllableUnit.OrderType.Reg);
     }
 }
示例#7
0
        private void Awake()
        {
            rayCast            = this.GetComponent <Prototype.RayCast>();
            joystickController = new JoystickController();
            keyboardController = new KeyboardController(rayCast);
            spellCasting       = new SpellCasting(this);

            playerUnits.items.Clear();
            for (int i = 0; i < units.Length && units[i] != null; i++)
            {
                unitPortraits[i].gameObject.SetActive(true);
                units[i] = Instantiate(units[i]);
                units[i].gameObject.SetActive(false);
                units[i].Initialize(this, unitPortraits[i]);
            }
            currentUnit     = units[0];
            currentAnimator = currentUnit.GetComponentInChildren <Animator>();
            currentUnit.transform.position = playerSpawn;
            currentUnit.gameObject.SetActive(true);
            playerUnits.Add(currentUnit);
            GetComponent <CameraController>().UpdateTarget(currentUnit.gameObject);
            spellCasting.UpdateSpellBook(ref currentUnit.spellBook);
        }
示例#8
0
 public virtual void Initialize(PlayerController playerController, ControllableUnit unit)
 {
     this.playerController = playerController;
     this.unit             = unit;
 }