void AddEffect(Type t) { ShotEffect effect = (ShotEffect)Activator.CreateInstance(t); curShot.effects.Add(effect); effect.effectName = t.Name + curShot.effects.Count; }
public static ShotEffect Add(float x, float y, float z) { // Enemyインスタンスの取得 ShotEffect se = parent.Add(x, y, z); return(se); }
public IEnumerator Exploson(GameObject col, float time) { ShotEffect es = ShotEffect.Add(col.transform.position.x, col.transform.position.y, col.transform.position.z); yield return(new WaitForSeconds(time)); es.Vanish(); }
void LeftSidebar() { using (new EditorGUILayout.VerticalScope(GUILayout.Width(200))) { // Editor buttons if (GUILayout.Button("New Shot")) { AddShot(); } List <string> effectTypeNames = new List <string>(); foreach (Type t in effectTypes) { effectTypeNames.Add(t.Name); } newEffectType = EditorGUILayout.Popup(newEffectType, effectTypeNames.ToArray()); if (GUILayout.Button("Add Effect")) { AddEffect(effectTypes[newEffectType]); } // Shot list using (var scroll = new EditorGUILayout.ScrollViewScope(shotScroll)) { shotScroll = scroll.scrollPosition; foreach (CutsceneShot shot in cutscene.shots) { if (GUILayout.Button(shot.shotName)) { curShot = shot; } } } // Effect list using (var scroll = new EditorGUILayout.ScrollViewScope(effectScroll)) { effectScroll = scroll.scrollPosition; foreach (ShotEffect effect in curShot.effects) { if (GUILayout.Button(effect.effectName)) { curEffect = effect; } } } } }
public void reset(GameObject shootedFrom, Vector3 horizontalDirection, Quaternion rotation) { Vector3 startPosition = shootedFrom.transform.position + shootedFrom.GetComponent <Stats>().shootOffset; Vector3 startDirection = shootedFrom.GetComponent <CharacterController>().velocity; startDirection += (horizontalDirection.normalized + new Vector3(0, 0.2f, 0)) * shootedFrom.GetComponent <Stats>().shotSpeed; List <ShotEffect> listToCopy = shootedFrom.GetComponent <Stats>().possibleShotEffects; List <ShotEffect> copyOfEffectList = new List <ShotEffect>(); ShotEffect[] pufferarray = new ShotEffect[listToCopy.Count]; listToCopy.CopyTo(pufferarray); copyOfEffectList.AddRange(pufferarray); reset(shootedFrom, startPosition, startDirection, rotation, copyOfEffectList); }
void EffectEditor(ShotEffect effect) { using (new EditorGUILayout.HorizontalScope()) { GUILayout.Label("Effect Name:", GUILayout.Width(200)); effect.effectName = EditorGUILayout.TextField(effect.effectName); } using (new EditorGUILayout.HorizontalScope()) { GUILayout.Label("Start Time:", GUILayout.Width(200)); effect.startTime = EditorGUILayout.FloatField(effect.startTime); } effect.ShowEditor(); EditorGUILayout.LabelField("Effect Script:"); GUILayout.TextArea(effect.GenerateScript()); }
public void reset(GameObject shootedFrom, Vector3 horizontalDirection) { Stats stats = shootedFrom.GetComponent <Stats>(); Vector3 startPosition = shootedFrom.transform.position + shootedFrom.GetComponent <Stats>().shootOffset; Vector3 startDirection = shootedFrom.GetComponent <CharacterController>().velocity *characterMovementMultiplicator; startDirection += (horizontalDirection.normalized + new Vector3(0, 0, 0)) * stats.shotSpeed; float timeUntilSFalloff = stats.TimeUntilShotFalloff; List <ShotEffect> listToCopy = shootedFrom.GetComponent <Stats>().possibleShotEffects; List <ShotEffect> copyOfEffectList = new List <ShotEffect>(); ShotEffect[] pufferarray = new ShotEffect[listToCopy.Count]; listToCopy.CopyTo(pufferarray); copyOfEffectList.AddRange(pufferarray); reset(shootedFrom, startPosition, startDirection, timeUntilSFalloff, copyOfEffectList); }
public void removeActivShotEffect(ShotEffect effectToRemove) { effectsToExecute.Remove(effectToRemove); }
// Resolve an effect caused by a projectile when hit // When damage, take damage. When debuff, add to debuff list public void resolveEffect(ShotEffect effect) { Debug.Log("Dealing with effect " + effect.type + " of value " + effect.value + " and duration " + effect.duration); switch (effect.type) { case EffectType.PhysicalDamage: case EffectType.ExplosionDamage: takeDamage(effect.value); break; case EffectType.Burn: if (!debuffs.ContainsKey(effect.type)) { debuffs.Add(effect.type, new EffectTimer(effect.value, 1.0f, effect.duration)); } else { // ShotEffect existingEffect = debuffs[effect.type].effect; EffectTimer effTmr = debuffs[EffectType.Burn]; if (effect.value > effTmr.value) { effTmr.value = effect.value; } if (effect.duration > effTmr.timer) { effTmr.timer = effect.duration; } } break; case EffectType.Freeze: if (!debuffs.ContainsKey(effect.type)) { debuffs.Add(effect.type, new EffectTimer(effect.value, effect.duration, effect.duration)); speedModifier -= effect.value; } else { EffectTimer effTmr = debuffs[EffectType.Freeze]; if (effect.value > effTmr.value) { speedModifier += effTmr.value; effTmr.value = effect.value; speedModifier -= effTmr.value; } if (effect.duration > effTmr.timer) { effTmr.timer = effect.duration; effTmr.duration = effect.duration; } } break; case EffectType.Stun: if (!debuffs.ContainsKey(effect.type)) { debuffs.Add(effect.type, new EffectTimer(effect.value, effect.duration, effect.duration)); stunned = true; } break; default: Debug.Log("Default case! Your effect went wrong"); break; } }
public Vector GetNextShoot(Vector lastShootTarget, ShotEffect lastShoot) { SendMessage("{0} {1} {2}", lastShoot, lastShootTarget.X, lastShootTarget.Y); return(RceiveNextShoot()); }