コード例 #1
0
ファイル: ControlMgr.cs プロジェクト: ryan-tech/BattleBoats
    // Update is called once per frame
    void Update()
    {
        player_entity.desiredSpeed   = Utils.Clamp(player_entity.desiredSpeed, player_entity.minSpeed, player_entity.maxSpeed);
        player_entity.desiredHeading = Utils.Degrees360(player_entity.desiredHeading);

        if (Input.GetMouseButtonDown(1))
        {
            //Debug.Log("Control read a right click");
            if (Physics.Raycast(c.ScreenPointToRay(Input.mousePosition), out hit))
            {
                //Debug.Log("Ray was cast");
                Vector3 pos = hit.point;
                pos.y = 0;

                Move m = new Move(player_entity, pos, 10);
                player_entity.SetCommand(m);

                //Debug.DrawRay(player_entity.transform.position, hit.point, Color.green, 2);
            }
            else
            {
                //Debug.Log("Wtf");
            }
        }

        if (Input.GetKey(KeyCode.Escape))
        {
            Application.Quit();
        }
    }
コード例 #2
0
ファイル: EnemyMgr.cs プロジェクト: ryan-tech/BattleBoats
 // Update is called once per frame
 void Update()
 {
     foreach (GameObject e in enemies)
     {
         Entity381 enemy_entity = e.GetComponent <Entity381>();
         if (Vector3.Distance(enemy_entity.position, ControlMgr.inst.player_entity.position) > 50)
         {
             Intercept m = new Intercept(enemy_entity, ControlMgr.inst.player_entity.position, 50);
             enemy_entity.SetCommand(m);
         }
         else
         {
         }
     }
 }