Beispiel #1
0
 void Start()
 {
     m = Managers.Get();
     SetFacing(facing);
     fx.Spawn(Keys.Health);
     m.units.Add(this);
 }
Beispiel #2
0
 public void Init(Attack a)
 {
     atk          = a;
     image.sprite = atk.attackIcon;
     label.text   = atk.description;
     m            = Managers.Get();
 }
Beispiel #3
0
    public void GameOver(bool hasWon)
    {
        Managers m = Managers.Get();

        m.ui.OnGameOver(hasWon);
        m.units.OnGameOver();
    }
Beispiel #4
0
    public void Remove(Unit u)
    {
        allUnits.Remove(u);
        if (u.faction == Faction.Hero)
        {
            heroUnits.Remove(u);
        }

        if (u.faction == Faction.Hero)
        {
            //hero was killed! do we have any heros left?
            if (heroUnits.Count == 0)
            {
                Debug.Log("[UnitManager] GAME OVER -- lost");
                Managers.Get().game.GameOver(false);
            }
        }

        if (u.faction == Faction.Enemy)
        {
            if (u.deathCausesGameEnd)
            {
                Managers.Get().game.GameOver(true);
            }
            levellingHack *= levellingMod;
        }
    }
Beispiel #5
0
    public void ShowView()
    {
        Managers  m    = Managers.Get();
        Transform view = Instantiate(viewToShow);

        view.SetParent(m.ui.transform, false);
    }
Beispiel #6
0
    public FXUnit Spawn(string key)
    {
        if (m == null)
        {
            m = Managers.Get();
        }
        // todo: stop multiple spawns?
        FXData data = getFXData(key);

        if (data == null && this != m.units.baseFX)
        {
            data = m.units.baseFX.getFXData(key);
            if (data != null)
            {
                return(spawnInternal(data));
            }
            // FXUnit unit = (FXUnit)Instantiate(data.prefab);
            // unit.Init(data);
            // if(data.persist)
            // {
            //   instantiatedPrefabs[data.key] = unit;
            // }
            // return unit;
        }
        else
        {
            //we have data
            return(spawnInternal(data));
        }
        Debug.Log("[FXSpawner] Attempted to spawn fx with key:" + key + " but no fx unit found!", gameObject);
        foreach (FXData fx in dataMap.Values)
        {
            Debug.Log("[FXSpawner] we have:" + fx.key);
        }
        return(null);
    }
Beispiel #7
0
 void Start()
 {
     m = Managers.Get();
 }
Beispiel #8
0
 void Start()
 {
     cam         = Camera.main;
     groundPlane = new Plane(Vector3.forward, ground.transform.position);
     m           = Managers.Get();
 }
Beispiel #9
0
 void Start()
 {
     m    = Managers.Get();
     unit = GetComponentInParent <Unit>();
     unit.OnUpdateEnd.AddListener(Tick);
 }
Beispiel #10
0
 void Start()
 {
     Managers.Get().ui.gameObject.SetActive(true);
 }
Beispiel #11
0
 // for animation system
 public void PlayAudioFX(string key)
 {
     Managers.Get().afx.PlayFX(key);
 }