Пример #1
0
 private void SelectingShipUpdate()
 {
     if (playerRef.GetButtonDown("Left"))
     {
         currentlySelectedShip--;
         if ((int)currentlySelectedShip < 0)
         {
             currentlySelectedShip = (CastleShip.CastleShipType) 2;
         }
         onShipChanged(battleManagerRef.GetShip(currentlySelectedShip));
     }
     else if (playerRef.GetButtonDown("Right"))
     {
         currentlySelectedShip++;
         if ((int)currentlySelectedShip >= 3)
         {
             currentlySelectedShip = 0;
         }
         onShipChanged(battleManagerRef.GetShip(currentlySelectedShip));
     }
     else if (playerRef.GetButtonDown("Accept"))
     {
         ChangeToPlaying();
     }
 }
Пример #2
0
 private void AddShip(CastleShip.CastleShipType castleShipType, bool ai = false)
 {
     if (CastleShip != null)
     {
         RemoveShip();
     }
     castleShip = battleManagerRef.SpawnShip(castleShipType, this.BoundPlayerID, this.spawnPosition, ai);
     CastleShip.OnGoldChanged += AddGold;
     CastleShip.OnKill        += AddKill;
     CastleShip.SetColourMaterial(this.playerColour);
     playerUIManager.ConnectToCastleShip(CastleShip);
     CastleShip.DamageableRef.OnDeath.AddListener(OnShipDie);
 }
Пример #3
0
    public CastleShip SpawnShip(CastleShip.CastleShipType shipType, int playerId, Transform spawnTransform, bool ai = false)
    {
        GameObject newShip = ai ? Instantiate(AIShipDict[shipType], spawnTransform) : Instantiate(ShipDict[shipType], spawnTransform);

        newShip.transform.position = spawnTransform.position;
        newShip.transform.rotation = spawnTransform.rotation;
        if (!ai)
        {
            newShip.GetComponent <PlayerControlled>().AssignPlayer(playerId);
        }
        targetGroup.AddMember(newShip.transform, 1.0f, 3.0f);
        return(newShip.GetComponent <CastleShip>());
    }
Пример #4
0
 public CastleShip GetShip(CastleShip.CastleShipType shipType)
 {
     return(ShipDict[shipType].GetComponent <CastleShip>());
 }