//Used to add to the effectedObjectList public void AddedEffectedObject(Rigidbody touchedObject, PhysicsEffect physicsEffect, GameObject attachedGameObject) { if (effectedObjectList.Count == 0) { EffectedObject effectedObject = new EffectedObject(Time.time, touchedObject, physicsEffect); effectedObjectList.Add(effectedObject); CreateAttachedGameObject(touchedObject, attachedGameObject); } else if ((effectedObjectList.Count > 0)) { bool checkIfExists = false; foreach (EffectedObject item in effectedObjectList) { if (item.touchedObject == touchedObject) { item.effectedTime = Time.time; checkIfExists = true; break; } } if (!checkIfExists) { EffectedObject effectedObject = new EffectedObject(Time.time, touchedObject, physicsEffect); effectedObjectList.Add(effectedObject); CreateAttachedGameObject(touchedObject, attachedGameObject); } } }
public void Add(Rigidbody rigid, float gameTime, float timeEffected) { bool foundFlag = false; for (int i = 0; i < EffectedObjects.Count; i++) { if (EffectedObjects[i]._rigidbody == rigid) { EffectedObjects[i].GameTime = gameTime; EffectedObjects[i].TimeEffected = timeEffected; foundFlag = true; break; } } if (!foundFlag) { var item = new EffectedObject(); item._rigidbody = rigid; item.GameTime = gameTime; item.TimeEffected = timeEffected; SetEffectedObjectHistory(rigid, item); EffectedObjects.Add(item); } UpdateEffectedObject(rigid); }
public void Shake(Vector2 direction, GameObject obj, float duration, float intensity, float decay) { EffectedObject container = new EffectedObject(obj); container.shake = true; container.shakeDuration = duration; container.shakeVector = direction; container.intensity = intensity; container.decay = decay; container.startPos = obj.transform.position; if (effectedObjects.Count > 0) { for (int i = effectedObjects.Count - 1; i >= 0; --i) { if (effectedObjects[i].obj == obj) { effectedObjects.Remove(effectedObjects[i]); } } } effectedObjects.Add(container); }
public virtual void ResetEffectedObject(EffectedObject effectedObject) { }
public virtual void SetEffectedObjectHistory(Rigidbody rigid, EffectedObject effectedObject) { }
public override void ResetEffectedObject(EffectedObject effectedObject) { base.ResetEffectedObject(effectedObject); effectedObject._rigidbody.gravityScale = 1f; }
public override void ResetEffectedObject(EffectedObject effectedObject) { base.ResetEffectedObject(effectedObject); effectedObject._rigidbody.useGravity = true; }