Exemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        if (canFly)
        {
            CPCS.UpdateFuel(lastFuelVolume);

            lastFuelVolume -= Time.deltaTime;

            if (lastFuelVolume <= 0.1f)
            {
                // Отключить игрока
                canFly = false;
                SpaceShipControl ssc = FindObjectOfType <SpaceShipControl>();
                ssc.FreezeAll();
                EndGame(endMessage_01);
            }
        }
        else
        {
            if (Input.GetKey(KeyCode.Return))
            {
                ControlPanelCanvasScript cpcs = FindObjectOfType <ControlPanelCanvasScript>();
                cpcs.CloseEndMessage();
            }
        }
    }
Exemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        _playerManager       = GetComponent <PlayerManager>();
        _spaceShipController = GetComponent <SpaceShipControl>();

        if (isMine())
        {
            //MINE: local player, simply enable the local scripts
            _spaceShipController.enabled = true;
        }
        else
        {
            _spaceShipController.enabled        = true;
            _spaceShipController.isControllable = false;
        }
    }
Exemplo n.º 3
0
 public override void SetComponent(Component comp)
 {
     if (comp.ClassId == pos.ClassId)
     {
         pos = (Position)comp;
     }
     else if (comp.ClassId == control.ClassId)
     {
         control = (SpaceShipControl)comp;
     }
     else if (comp.ClassId == display.ClassId)
     {
         display = (Display)comp;
     }
     else
     {
         throw new Exception("You passed a wrong component to the " + this.GetType().Name + " class");
     }
 }
Exemplo n.º 4
0
    void OnGUI()
    {
        GUI.BeginGroup(new Rect(0, 0, Screen.width, Screen.height));
        GUI.Box(new Rect(Screen.width / 2 - 75, 0, 150, 30), "Organize sua equipe");
        GUI.Box(new Rect(Screen.width / 2 - 75, 40, 150, 30), "Total disponivel: " + team.ToString());

        GUI.Box(new Rect(Screen.width / 2 - 50, 80, 100, 30), "Mecanico: " + mec.ToString());
        if (GUI.Button(new Rect(Screen.width / 2 + 50, 95, 15, 15), "+"))
        {
            if (team > 0)
            {
                UpdateTeam(1, 1);
            }
        }

        if (GUI.Button(new Rect(Screen.width / 2 + 70, 95, 15, 15), "-"))
        {
            if (mec > 0)
            {
                UpdateTeam(1, -1);
            }
        }


        GUI.Box(new Rect(Screen.width / 2 - 50, 120, 100, 30), "CoPiloto: " + cop.ToString());
        if (GUI.Button(new Rect(Screen.width / 2 + 50, 135, 15, 15), "+"))
        {
            if (team > 0)
            {
                UpdateTeam(2, 1);
            }
        }

        if (GUI.Button(new Rect(Screen.width / 2 + 70, 135, 15, 15), "-"))
        {
            if (cop > 0)
            {
                UpdateTeam(2, -1);
            }
        }

        GUI.Box(new Rect(Screen.width / 2 - 50, 160, 100, 30), "Armeiros: " + gun.ToString());
        if (GUI.Button(new Rect(Screen.width / 2 + 50, 175, 15, 15), "+"))
        {
            if (team > 0)
            {
                UpdateTeam(3, 1);
            }
        }

        if (GUI.Button(new Rect(Screen.width / 2 + 70, 175, 15, 15), "-"))
        {
            if (gun > 0)
            {
                UpdateTeam(3, -1);
            }
        }

        GUI.EndGroup();

        if (GUI.Button(new Rect(Screen.width / 2 - 50, 200, 100, 30), "INICIAR"))
        {
            if (team == 0)
            {
                goPlayer.gameObject.SetActive(true);
                script = goPlayer.GetComponent <SpaceShipControl>() as SpaceShipControl;
                script.UpdateTeamStats(mec, cop, gun);
                goPlayer.gameObject.GetComponent <GameControl>().Begin();
                Destroy(this);
            }
        }
    }
Exemplo n.º 5
0
 public AiPlayer(SpaceShipControl ai, SpaceShipControl opponent)
 {
     aiControl       = ai;
     opponentControl = opponent;
 }
Exemplo n.º 6
0
 private void Awake()
 {
     // Получение компонента управления кораблем
     spaceShipControl = GetComponent <SpaceShipControl>();
     shootTimer       = shootTimerValue;
 }
Exemplo n.º 7
0
 public override void SetUp()
 {
     pos     = new Position();
     control = new SpaceShipControl(Keys.Left, Keys.Right, new Velocity(50, 0, 0));
     display = new Display();
 }
Exemplo n.º 8
0
 public override void DisposeNode()
 {
     pos     = null;
     control = null;
     display = null;
 }