public void CallCommand(CommandEnum requested, RaycastHit clicked)
 {
     if(clicked.Equals(null) || team == null) return;
     switch((CommandEnum)requested){
         case CommandEnum.Move:
             team.AddCommand(new MoveCommand(team, clicked.transform.position));
             break;
         case CommandEnum.ArmMine:
             team.AddCommand(new MineCommand(team));
             break;
         case CommandEnum.BlowDoor:
             throw new System.NotImplementedException("BlowDoor");
             break;
         case CommandEnum.BlowWindow:
             throw new System.NotImplementedException("BlowWindow");
             break;
         case CommandEnum.CoverHostage:
             throw new System.NotImplementedException("CoverHostage");
             break;
         case CommandEnum.ForceDoor:
             throw new System.NotImplementedException("ForceDoor");
             break;
         case CommandEnum.OpenDoor:
             team.AddCommand(new DoorCommand(team, clicked.transform.gameObject));
             break;
         case CommandEnum.OpenWindow:
             team.AddCommand(new OpenWIndowCommand(team, clicked.transform.gameObject.GetComponent<Window>()));
             break;
         case CommandEnum.ThrowFragGrenade:
             team.AddCommand(new FragGrenadeCommand(team));
             break;
         case CommandEnum.ThrowFlashGrenade:
             throw new System.NotImplementedException("FlashGrenade");
             break;
         case CommandEnum.Wait:
             throw new System.NotImplementedException("WaitPoint");
             break;
         default:
             break;
     }
 }
예제 #2
0
    bool CheckForPointerOnBall()
    {
        Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        RaycastHit hit = new RaycastHit();
        bool hitFound =	 Physics.Raycast(ray, out hit);

        Debug.DrawRay(Camera.main.transform.position, ray.direction, Color.red, 10.0f);

        if(hitFound){
        if(!hit.Equals(null) && !hit.collider.Equals(null))
            if(hit.collider.name.Equals(gameObject.name))
                return true;
        }
        return false;
    }