public override List <GameUnit> SearchUnits(LayerMask canAcquire, EventCaster ev) { List <GameUnit> casterList = new List <GameUnit>(); casterList.Add(ev.caster); return(casterList); }
public override void DoEffect(GameUnit caster, Vector3 target, LayerMask canHit, EventCaster eventCaster) { foreach (GameUnit hit in eventCaster.acquiredUnits) { Instantiate(prefab, hit.HitFxPosition(), Quaternion.identity); } }
public override void DoEffect(GameUnit caster, Vector3 target, LayerMask canHit, EventCaster eventCaster) { foreach (GameUnit hit in eventCaster.acquiredUnits) { hit.condM.InputSlow(slowDuration, speedModifier); } }
public override void DoEffect(GameUnit caster, Vector3 target, LayerMask canHit, EventCaster eventCaster) { foreach (GameUnit hit in eventCaster.acquiredUnits) { hit.condM.InputBlaze(blazeDuration); } }
public override void DoEffect(GameUnit caster, Vector3 target, LayerMask canHit, EventCaster eventCaster) { foreach (GameUnit hit in eventCaster.acquiredUnits) { hit.health.Damage(damageAmount, caster); } }
public override void DoEffect(GameUnit caster, Vector3 target, LayerMask canHit, EventCaster eventCaster) { foreach (GameUnit hit in eventCaster.acquiredUnits) { Vector3 destination = hit.HitFxPosition(); CreateProjectile(caster, hit, destination); } }
public static void CastEvent(GameObject sender, string msg) { EventCaster ec = sender.GetComponent <EventCaster>(); if (ec) { CastEvent(sender, msg, null); } }
public static void SendMessageToListener(GameObject obj, string msg, Object context) { EventCaster ec = obj.GetComponent <EventCaster>(); if (ec) { ec.SendMessageToListeners(msg, context); } }
public override void DoEffect(GameUnit caster, Vector3 target, LayerMask canHit, EventCaster eventCaster) { foreach (GameUnit hit in eventCaster.acquiredUnits) { if (hit != null) { hit.health.DestroyUnit(); } } }
static public void CastEvent(GameObject sender, string msg, EventContext context) { EventCaster ec = sender.GetComponent <EventCaster>(); if (ec) { if (context != null) { context = new EventContext(); } context.sender = sender; ec.CastEvent(msg, context); } }
public override List <GameUnit> SearchUnits(LayerMask canAcquire, EventCaster ev) { Collider[] col = Physics.OverlapSphere(ev.transform.position, sphereRadius, canAcquire); List <GameUnit> unitList = new List <GameUnit>(); foreach (Collider hit in col) { GameUnit hitUnit = hit.GetComponent <GameUnit> (); if (hitUnit != ev.caster || canHitCaster) { unitList.Add(hitUnit); } } return(unitList); }
public void Cast(GameUnit caster, Vector3 target) { foreach (AbilityEvent ev in abilityEvents) { GameObject evObj = new GameObject("EventObject"); //Generate EventObject evObj.transform.position = ev.eventPosition.eventPos(caster, target); //Place EventObject ev.eventRotation.eventRotation(caster, target, evObj.transform); //Rotate EventObject EventCaster evCaster = evObj.AddComponent <EventCaster> (); //Add EventCaster monobehavior evCaster.caster = caster; //Pass caster ref to event evCaster.target = target; //Pass target location to event evCaster.startTime = Time.time + ev.startTime; //When event start evCaster.endTime = ev.endTime; //Delay before event is destroyed evCaster.effects = ev.effect; //Array of effects to performs evCaster.interrupts = ev.eventInterrupt; //Condition(s) for destroying the event early if (allowFriendlyFire) { evCaster.canHit = caster.preset.faction.friendlyFire; //Effects can hit anything } else { evCaster.canHit = caster.preset.faction.canHit; //Effect can hit only neutrals/hostiles } } }
public override void DoEffect(GameUnit caster, Vector3 target, LayerMask canHit, EventCaster eventCaster) { AkSoundEngine.PostEvent(eventName, eventCaster.gameObject); }
public abstract List <GameUnit> SearchFilter(List <GameUnit> targets, GameUnit caster, Vector3 target, EventCaster eventCaster);
public abstract List <GameUnit> SearchUnits(LayerMask canAcquire, EventCaster ev);
public override void DoEffect(GameUnit caster, Vector3 target, LayerMask canHit, EventCaster eventCaster) { eventCaster.acquiredUnits = searchFilter.SearchFilter(searchPattern.SearchUnits(eventCaster.canHit, eventCaster), caster, target, eventCaster); }
public override void DoEffect(GameUnit caster, Vector3 target, LayerMask canHit, EventCaster eventCaster) { caster.agent.Warp(eventCaster.transform.position); caster.controller.worldTarget = eventCaster.transform.position; }
public abstract void DoEffect(GameUnit caster, Vector3 target, LayerMask canHit, EventCaster eventCaster);
public StateMachine ChangeSubState(string stateName, EventContext context) { if (currentSubState && currentSubState.name == stateName) { return(null); } if (GetActiveState() != null) { lastStateName = GetActiveState().name; } StateMachine newState; if (subStates == null) { subStates = new Hashtable(); foreach (Transform child in transform) { StateMachine sm = child.GetComponent <StateMachine>(); if (sm) { sm.isRoot = false; subStates[child.name] = sm; child.gameObject.SetActive(false); } } } if (!subStates.Contains(stateName)) { newState = CreateSubState(stateName, gameObject.transform); subStates[stateName] = newState; } else { newState = subStates[stateName] as StateMachine; } StateMachine tail = currentSubState; if (tail) { // Recursively exits nested states // - Invoke EvStateExit event on tails and deactivate it // - Cut currentSubStates off from the parents of tails while (tail.currentSubState) { tail = tail.currentSubState; } while (tail && tail != this) { tail.SendMessage("EvStateExit", null, SendMessageOptions.DontRequireReceiver); tail.gameObject.SetActive(false); tail = tail.GetParentStateMachine(); if (tail) { tail.currentSubState = null; } } } currentSubState = newState; if (currentSubState != null) { currentSubState.gameObject.SetActive(true); currentSubState.gameObject.SendMessage("EvStateEnter", context, SendMessageOptions.DontRequireReceiver); } if (GetRootStateMachine().isStateChangeNotificationRequired) { EvStateDidChangeContext changedContext = new EvStateDidChangeContext(); changedContext.statePath = GetStatePath(); EventCaster.CastEvent(GetRootStateMachine().gameObject, "EvStateDidChange", changedContext); } return(currentSubState); }
public override List <GameUnit> SearchFilter(List <GameUnit> targets, GameUnit caster, Vector3 target, EventCaster eventCaster) { return(targets); }
public override List <GameUnit> SearchFilter(List <GameUnit> targets, GameUnit caster, Vector3 target, EventCaster eventCaster) { if (targets.Count <= maxAmountOfTargets) { return(targets); } List <TargetUnit> sortableList = new List <TargetUnit>(); foreach (GameUnit unit in targets) { sortableList.Add(new TargetUnit(unit, GetMinusSqrDist(caster.transform.position, unit.transform.position))); } sortableList.Sort(); List <GameUnit> filteredList = new List <GameUnit>(); int amount = Mathf.Clamp(sortableList.Count, 1, maxAmountOfTargets); for (int i = 0; i < amount; i++) { filteredList.Add(sortableList[i].unit); } return(filteredList); }
public override void DoEffect (GameUnit caster, Vector3 target, LayerMask canHit, EventCaster eventCaster) { //Instantiate (prefab, eventCaster.transform, false); Instantiate (prefab, eventCaster.transform.position + offset, eventCaster.transform.rotation, eventCaster.transform); }
public override void DoEffect(GameUnit caster, Vector3 target, LayerMask canHit, EventCaster eventCaster) { eventCaster.transform.Translate(worldTranslate, Space.Self); }