Beispiel #1
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetMouseButtonDown(0))
     {
         if (ShootRayHitCol().tag == "Character" || ShootRayHitCol().tag == "Building")
         {
             Select(ShootRayHitCol().gameObject);
         }
     }
     if (Input.GetMouseButtonDown(1))
     {
         if (selected)
         {
             if (ShootRayHitCol().tag == "Ground" && selected.GetComponent <PAC_Movement_Controller>().GetMoveable())
             {
                 selectedMove.SetCharacterTarget(null);
                 Vector3 mousePoint = new Vector3(Camera.main.ScreenToWorldPoint(Input.mousePosition).x, Camera.main.ScreenToWorldPoint(Input.mousePosition).y, 0);
                 selectedMove.SetVectorTarget(mousePoint);
             }
             else
             {
                 Debug.LogWarning("Selected unit is not movable");
             }
             if (ShootRayHitCol().tag == "Character")
             {
                 Character_Stats rightClickCharacterStats = ShootRayHitCol().GetComponent <Character_Stats>();
                 if (rightClickCharacterStats.GetPlayerNum() != selectedStats.GetPlayerNum())
                 {
                     print("Attack");
                     selectedAttackCon.SetAttackTarget(ShootRayHitCol().gameObject);
                     selectedMove.SetCharacterTarget(ShootRayHitCol().gameObject);
                 }
                 else
                 {
                     selectedMove.SetCharacterTarget(ShootRayHitCol().gameObject);
                 }
             }
         }
         else
         {
             Debug.LogWarning("No unit selected");
         }
     }
 }