//прерывание и смена состояния public virtual void changeStrategy(StrategysType strategyType) { if (_allStrategy.ContainsKey(strategyType)) { _currentStrategy = _allStrategy[strategyType]; _currentStrategy.onStartState(_target); _target = _currentStrategy.target; } }
public override void onAttack(AbstractInteractive target) { BasicCreature combatEnemy = (BasicCreature)target; if (Random.Range(0.0f, 1.0f) < stunChance) { StunStrategy stun = new StunStrategy (combatEnemy, stunTime); combatEnemy.creatureAI.changeStrategy(stun); } }
public float[] fireEffect(EffectActionTypes[] keys, float[] paramList, AbstractInteractive target) { List<AbstracteEffect> effectList = getEffectListByKey(new HashSet<EffectActionTypes>(keys)); foreach (AbstracteEffect effect in effectList) { paramList = effect.execute(keys, paramList, target); } return paramList; }
void FixedUpdate() { if (_init && _currentStrategy.isFinish()) { _currentStrategy.onFinishState(); setNewStrategy(); _currentStrategy.onStartState(_target); _target = _currentStrategy.target; } }
public override void onStartState(AbstractInteractive stateTarget) { _creature.fireEffect( new EffectActionTypes[] {EffectActionTypes.ON_DIE}, new float[] {0}, null ); target = null; UnityEngine.Object.Destroy (_creature.creatureObject); }
public void addState(AbstractStrategy strategy, bool mainState = false) { if (mainState == null) mainState = false; _allStrategy.Add (strategy.getStrategyType(), strategy); if (mainState) { _currentStrategy = strategy; _currentStrategy.onStartState(_target); _target = _currentStrategy.target; } }
public override void OnInspectorGUI() { if (GUILayout.Button("Add Listener from scene")) { SelectListenerFromScene window = (SelectListenerFromScene)EditorWindow.GetWindow(typeof(SelectListenerFromScene), true, "Interactive listeners management"); AbstractInteractive monobehaviorPropertyEditor = (AbstractInteractive)target; window.SetInteractive(monobehaviorPropertyEditor); window.Show(); } base.OnInspectorGUI(); }
public override void onStartState(AbstractInteractive strategyTarget) { target = strategyTarget; float[] returnedArr = _creature.fireEffect( new EffectActionTypes[] {EffectActionTypes.ON_START_CAPTURE, EffectActionTypes.GET_CAPTURE_TIME}, new float[] {0, _creature.propertyConfig.captureTime.getCurrent()}, target ); float captureTime = returnedArr [1]; // запустить this.__captureBuilding через _creature.captureTime сек. Timer.Instance.StartCoroutine(Timer.Instance.TimerStart(captureTime, __captureBuilding)); }
public override void onStartState(AbstractInteractive stateTarget) { //Найти ближайший маяк и передать его в target target = __findNextBeacon (); if(target != null) { _creature.agent.SetDestination( new Vector3( target.transform.position.x, target.collider.bounds.size.y + target.transform.position.y, target.transform.position.z ) ); } }
public virtual float[] execute(EffectActionTypes[] keys, float[] paramsLis, AbstractInteractive target) { for (int i = 0; i < keys.Length; i++){ switch (keys[i]){ case EffectActionTypes.ON_START_CAPTURE : onStartCapture(target); break; case EffectActionTypes.ON_CAPTURE : onCapture(target); break; case EffectActionTypes.ON_DIE : onDie(); break; case EffectActionTypes.ON_START_COMBAT : onStartCombat(target); break; case EffectActionTypes.ON_TAKE_DMG : onTakeDmg(target); break; case EffectActionTypes.ON_ATTACK : onAttack(target); break; case EffectActionTypes.GET_ARMOR : paramsLis[i] = getArmor(paramsLis[i]); break; case EffectActionTypes.GET_ATTACK_TIME : paramsLis[i] = getAttackTime(paramsLis[i]); break; case EffectActionTypes.GET_CAPTURE_TIME : paramsLis[i] = getCaptureTime(paramsLis[i]); break; case EffectActionTypes.GET_DMG : paramsLis[i] = getDmg(paramsLis[i]); break; } } return paramsLis; }
//прерывание и смена состояния public virtual void changeStrategy(AbstractStrategy startegy) { _currentStrategy = startegy; _currentStrategy.onStartState(_target); _target = _currentStrategy.target; }
public override void onStartState(AbstractInteractive stateTarget) { target = null; _creature.renderer.material.color = Color.blue; Timer.Instance.StartCoroutine(Timer.Instance.TimerStart(__stuneTime, __stunEnd)); }
/// <summary> /// After capture target /// </summary> /// <param name="target">Target.</param> public virtual void onCapture(AbstractInteractive target) { }
public virtual void onAttack(AbstractInteractive target) { }
/// <summary> /// Ons the start combat. /// </summary> /// <param name="target">Target - enemy in combat</param> public virtual void onStartCombat(AbstractInteractive target) { }
public virtual void onStartState(AbstractInteractive stateTarget) { }
public void SetInteractive(AbstractInteractive interactive) { this.interactive = interactive; }