/// <summary> /// triggers the AE Effect /// </summary> protected void DoAoEDamage() { if (ActivePrefab != null) { if (_net.IsServer) { Network.Destroy(ActivePrefab.gameObject); } else if (!_net.IsClient) { Destroy(ActivePrefab.gameObject); } } Projectile proj = ProjectilePool.GetProjectile(transform.position, Quaternion.Euler(Vector3.zero)); if (AoEPrefab != null) { proj.ActivePrefab = AoEPrefab; proj.PrefabSize = AoEPrefabSize; proj.PrefabRotation = AoEPrefabRotation; } proj.transform.localScale = AoESize; ((BoxCollider)collider).size = AoESize; proj.Knockback = AoEKnockbackVert; proj.AoEKnockbackHor = AoEKnockbackHor; proj.TimeToLive = AoETime; proj.Range = 1; proj.Speed = 0; proj.Player = Player; proj.DoPiercing = true; proj.Damage = AoEDamageValue; proj.Apply(); }
/// <summary> /// Called on every Frame /// Starts wind when break is finished /// stops wind when duration is over /// </summary> public void Update() { if (_net.IsClient) { return; } if (_remainingBreak > 0) { _remainingBreak -= Time.deltaTime; } if (_remainingBreak <= 0.7f && !_windAnimationEnabled) { CalculateDuration(); } if (_remainingBreak <= 0 && !_windEnabled) { _windEnabled = true; Projectile p = ProjectilePool.GetProjectile(transform.position, transform.rotation); p.DoPiercing = true; p.Damage = 0; p.Speed = 0; p.Range = 1; p.TimeToLive = _remainingDuration; p.transform.localScale = new Vector3(transform.parent.localScale.x - 1, 50, 100); p.transform.Translate(Vector3.down * 25); p.collider.transform.localScale = p.transform.localScale; p.Knockback = p.transform.forward * 50; p.Knockback.y += 50; p.Apply(); } if (_remainingBreak - 6 <= 0 && !_bubblesFired) { _bubblesFired = true; if (_net.IsServer) { networkView.RPC("InstantiateBubbles", RPCMode.All); } else { InstantiateBubbles(); } } if (_remainingDuration > 0) { _remainingDuration -= Time.deltaTime; } if (_remainingDuration <= 0 && _windEnabled) { CalculateBreak(); } }
/* { * get; * set; */ /// <summary> /// is called on Startup, initializes the ProjectilePool and calls the levelBuilder /// </summary> public void Start() { ProjectilePool.PoolSize = 100; ProjectilePool.GeneratePool(); LevelGenerator generator = new LevelGenerator(); GameObject levelBuilderGameObj = GameObject.Find("LevelBuilder"); if (levelBuilderGameObj != null) { levelBuilderGameObj.GetComponent <LevelBuilder>().Init(); levelBuilderGameObj.GetComponent <LevelBuilder>().BuildLevel(generator.GenerateNextLevel(2)); } }
/// <summary> /// sets up the Camera, start up the ProjectilePool, the GameManager, the Checkpoint the Bases and spawns the Heroes /// </summary> public void Awake() { CameraDistance = 20; ProjectilePool.PoolSize = 100; ProjectilePool.GeneratePool(); GameManager manager = GameManager.GetInstance(); GameObject g; int i = 1; while ((g = GameObject.Find("Checkpoint" + i)) != null) { Checkpoint c = g.GetComponent <Checkpoint>(); manager.Checkpoints.Add(c); c.Init(); i++; } Mobs.Base b = GameObject.Find("Base1").GetComponent <Mobs.Base>(); b.DisplayName = "Base Blue"; manager.GetTeam(1).AddMember(b); b.Team.AddMember(b.transform.FindChild("EliteMob1").GetComponent <Character>()); b.Team.AddMember(b.transform.FindChild("EliteMob2").GetComponent <Character>()); b = GameObject.Find("Base2").GetComponent <Mobs.Base>(); b.DisplayName = "Base Red"; manager.GetTeam(2).AddMember(b); b.Team.AddMember(b.transform.FindChild("EliteMob1").GetComponent <Character>()); b.Team.AddMember(b.transform.FindChild("EliteMob2").GetComponent <Character>()); _net = GameManager.GetInstance().NetworkController; if (_net.IsServer || _net.IsClient) { NetworkHeroSpawning(); } else { SpawnHeroes(); } }
/// <summary> /// triggers the Fork Effect /// </summary> protected void DoForkDamage() { if (ActivePrefab != null) { if (_net.IsServer) { Network.Destroy(ActivePrefab.gameObject); } else if (!_net.IsClient) { Destroy(ActivePrefab.gameObject); } } // fire 10 projectiles around the main projectile for (int i = 0; i < 20; i++) { Projectile proj = ProjectilePool.GetProjectile(transform.position, Quaternion.Euler(Vector3.up * 360 / 20 * i)); if (ForkPrefab != null) { proj.ActivePrefab = ForkPrefab; proj.PrefabSize = new Vector3(1, 1, 1); } proj.ForkTriggerEnemy = ForkTriggerEnemy; proj.transform.localScale = transform.localScale; proj.SetKnockback(); proj.ForkTriggerEnemy = _forkTriggerEnemy; proj.Knockback = proj.transform.forward.normalized * 10; proj.Knockback.y = 10; proj.Range = ForkArcRadius; proj.Speed = 17; proj.Player = Player; proj.Damage = Damage / 2; proj.ForkDamage = false; proj.Apply(); } }
protected override void PerformAttack() { /*if (_net.IsClient) * { * networkView.RPC("PerformAttack", RPCMode.Server); * } * else * {*/ Projectile proj = ProjectilePool.GetProjectile(transform.position, transform.rotation); proj.StartPosition = transform.position; proj.Range = MeeleRange; proj.renderer.enabled = false; proj.Speed = 10; proj.Player = this; proj.Damage = AttackDamage + BasicDamage; proj.Knockback = Vector3.zero; proj.ForkDamage = false; proj.ForkArcRadius = 0; proj.Apply(); // } StartCoroutine(AttackDelay("Attacking")); }
/// <summary> /// called on each frame /// do things like moving the projectile /// </summary> public void Update() { if (!_net.IsClient) { // don't do anything if inactive if (!Inactive) { // if Range is reached trigger if (Range <= Moved) { if (ForkDamage) { DoForkDamage(); } else if (AoEDamage) { DoAoEDamage(); } ProjectilePool.RemoveProjectile(this); } if ((!DoPiercing && HitCounter > 0) || (Time.time - SpawnTime > TimeToLive && Speed <= 0.0f)) { // Destroy on impact if (AoEDamage) { DoAoEDamage(); } ProjectilePool.RemoveProjectile(this); } Move(); } } }