Esempio n. 1
0
 public void Init(Unit unit, IEndEffect toSubs)
 {
     this.toSubs = toSubs;
     this.toSubs.GetEndAction += EndEffect;
     subInit(unit);
     base.Init();
 }
Esempio n. 2
0
 public TimeEffect(Unit targetUnit)
 {
     this.targetUnit = targetUnit;
     timer = MainController.Instance.TimerManager.MakeTimer(TimeSpan.FromSeconds(totalTime));
     timer.OnTimer += OnTimer;
     MainController.Instance.level.OnEndLevel += OnEndLevel;
     targetUnit.OnDead += OnTargetDead;
     endEffect = new IEndEffect();
 }
 private void EndEffect()
 {
     Debug.Log("End use visual effet " + EffectType);
     if (toSubs != null)
     {
         toSubs.GetEndAction -= EndEffect;
         toSubs = null;
     }
     if (DispellEffect != null)
     {
         DispellEffect.Play();
     }
     StopAbsorber(DistanceEFfect);
     StopAbsorber(SetEffectEffect);
     EndUse();
 }
Esempio n. 4
0
 public virtual void Init()
 {
     Parameters = Parameters.Copy();
     if (Control == null)
         Control = GetComponent<BaseControl>();
     animationController = GetComponentInChildren<AnimationController>();
     if(animationController == null)
         Debug.LogError("NO ANImator Controller");
     curHp = Parameters.Parameters[ParamType.Hp];
     //List<Weapon> weapons = new List<Weapon>();
     foreach (var inventoryWeapon in InventoryWeapons)
     {
         inventoryWeapon.Init(this, null);
         inventoryWeapon.gameObject.SetActive(false);
     }
     Control.SetSpped(Parameters.Parameters[ParamType.Speed]);
     if (InventoryWeapons.Count == 0)
     {
         Debug.LogWarning("NO WEAPON!!! " + gameObject.name);
         return;
     }
     InitWEapons();
     curWeapon = InventoryWeapons[0];
     curWeapon.gameObject.SetActive(true);
     OnShieldOff = new IEndEffect();
 }
Esempio n. 5
0
File: Unit.cs Progetto: Kinderril/p3
 public virtual void Init()
 {
     Parameters = ParametersScriptable.Get();
     var spd = Parameters[ParamType.Speed];
     if (spd != 0 && spd < 50)
     { 
         spd *= Formuls.SpeedCoef;
         Debug.LogError("Wrong speed " + name);
     }
     Parameters[ParamType.Speed] = spd / Formuls.SpeedCoef;
     if (Control == null)
         Control = GetComponent<BaseControl>();
     if (animationController == null)
         animationController = GetComponentInChildren<AnimationController>();
     if(animationController == null)
         Debug.LogError("NO ANImator Controller");
     curHp = Parameters[ParamType.Heath];
     //List<Weapon> weapons = new List<Weapon>();
     foreach (var inventoryWeapon in InventoryWeapons)
     {
         inventoryWeapon.Init(this, null);
         inventoryWeapon.gameObject.SetActive(false);
         inventoryWeapon.transform.SetParent(weaponsContainer,true);
     }
     Control.SetSpeed(Parameters[ParamType.Speed]);
     if (InventoryWeapons.Count == 0)
     {
         Debug.LogWarning("NO WEAPON!!! " + gameObject.name);
         return;
     }
     InitWEapons();
     curWeapon = InventoryWeapons[0];
     curWeapon.gameObject.SetActive(true);
     OnShieldOff = new IEndEffect();
 }