Beispiel #1
0
 public void UpdateBootsNumber(int newValue)
 {
     if (Boots.Count == newValue)
     {
         return;
     }
     if (Boots.Count < newValue)
     {
         while (Boots.Count < newValue)
         {
             M_Damagule newBoot = Instantiate(BootPrefab).GetComponent <M_Damagule>();
             newBoot.gameObject.GetComponent <C_Boot>().SetMainPlayer(mainPlayerModel);
             newBoot.InitializeBoot(Boots.Count + 1);
             newBoot.gameObject.GetComponent <C_Boot>().SetDistanceFromMain(distanceBetweenBoots * newBoot.GetId());
             Boots.Push(newBoot);
         }
     }
     else
     {
         while (Boots.Count > newValue)
         {
             M_Damagule bootToDestroy = Boots.Peek();
             bootToDestroy.gameObject.GetComponent <C_Boot>().destroyBoot();
             Boots.Pop();
         }
     }
 }
Beispiel #2
0
    // Use this for initialization
    void Start()
    {
        Boot = GetComponent <M_Damagule>();
        Vector2 pos = MainPlayer.GetPosition();

        pos.x -= distanceFromMain;
        Boot.SetNewPosition(pos);
    }
Beispiel #3
0
 public void SetMainPlayer(M_Damagule mainPlayer)
 {
     MainPlayer = mainPlayer;
 }
Beispiel #4
0
 float distanceBetweenBoots = 2f;//just for fun
 #endregion
 // Use this for initialization
 #region private_functions
 void Start()
 {
     mainPlayerModel = gameObject.GetComponent <M_Damagule>();
     Boots           = new Stack <M_Damagule>();
 }