コード例 #1
0
 // Use this for initialization
 void Awake()
 {
     firstAbility  = new Icicle();
     secondAbility = new IceBlock();
     thirdAbility  = new FrostCone();
     stats         = GetComponent <PlayerWizardStatsTest>();
 }
コード例 #2
0
    public void ShootIcicle()
    {
        if (icicleCurrentCD >= icicleCD)
        {
            animator.Play("MCBasicShotAnim");

            if (isPlayer1)
            {
                spawnTileIndex = movementController.currentTile.GetTileIndex() + 4;
                spawnPos       = GridManager.Instance.GetTile(spawnTileIndex).transform.position + new Vector3(0, 0.5f, 0);

                icicleInstance           = Instantiate(iciclePrefab, spawnPos, Quaternion.identity).GetComponent <Icicle>();
                icicleInstance.IsPlayer1 = isPlayer1;
                icicleInstance.Damage    = icicleDamage;
            }
            else
            {
                spawnTileIndex = movementController.currentTile.GetTileIndex() - 4;
                spawnPos       = GridManager.Instance.GetTile(spawnTileIndex).transform.position + new Vector3(0, 0.5f, 0);

                icicleInstance           = Instantiate(iciclePrefab, spawnPos, Quaternion.identity).GetComponent <Icicle>();
                icicleInstance.IsPlayer1 = isPlayer1;
                icicleInstance.Damage    = icicleDamage;
            }

            icicleCurrentCD = 0;
        }
    }
コード例 #3
0
    public override void Start()
    {
        base.Start();

        //remove the the current layer from collisions
        //collisionMask = collisionMask & ~(1 << gameObject.layer);
        icicle = GetComponent <Icicle>();
    }
コード例 #4
0
        public override RainDrop CreateOffensiveRainDrop()
        {
            // icicle image
            BitmapImage img    = new BitmapImage(new Uri(BaseUriHelper.GetBaseUri(Application.Current.MainWindow), "../Images/icicle.png"));
            Icicle      icicle = new Icicle(img);

            return(icicle);
        }
コード例 #5
0
 public void createRight()
 {
     if (!right)
     {
         Debug.Log("create right");
         GameObject go = GameObject.Instantiate(iciclePrefab, icicleRightSpawn.transform.position, icicleRightSpawn.transform.rotation);
         right      = go.GetComponent <Icicle>();
         right.lane = Lanes.R;
     }
 }
コード例 #6
0
 public void createCenter()
 {
     if (!center)
     {
         Debug.Log("create center");
         GameObject go = GameObject.Instantiate(iciclePrefab, icicleCenterSpawn.transform.position, icicleCenterSpawn.transform.rotation);
         center      = go.GetComponent <Icicle>();
         center.lane = Lanes.M;
     }
 }
コード例 #7
0
 public void createLeft()
 {
     if (!left)
     {
         Debug.Log("create left");
         GameObject go = GameObject.Instantiate(iciclePrefab, icicleLeftSpawn.transform.position, icicleLeftSpawn.transform.rotation);
         left      = go.GetComponent <Icicle>();
         left.lane = Lanes.L;
     }
 }
コード例 #8
0
ファイル: MonsterXmlReader.cs プロジェクト: Codinablack/Tibia
        private static Icicle ParseIcicleCombatData(XElement element)
        {
            Icicle icicle = new Icicle();

            if (element.Attribute("min") is XAttribute minAttribute)
            {
                icicle.Min = short.Parse(minAttribute.Value);
            }

            if (element.Attribute("max") is XAttribute maxAttribute)
            {
                icicle.Max = short.Parse(maxAttribute.Value);
            }

            return(icicle);
        }
コード例 #9
0
    void OnTriggerEnter(Collider other)
    {
        Icicle i = other.gameObject.GetComponent <Icicle> ();

        if (i && !i.alreadyhit)
        {
            i.alreadyhit = true;
            player.BossAttacked(damage, i.lane);
            if (yeti.state == YetiState.GroundPound)
            {
                if ((yeti.gpLane & i.lane) != Lanes.None)
                {
                    yeti.IcicleHurt(damage);
                }
            }
        }
    }
コード例 #10
0
    void HorizontalCollisions(ref Vector2 moveAmount)
    {
        //if (hat.collisionSkip) return;
        Vector2 oldVelocity = hat.velocity;

        float directionX = collisions.faceDir;
        float rayLength  = Mathf.Abs(moveAmount.x) + skinWidth;

        if (Mathf.Abs(moveAmount.x) < skinWidth)
        {
            rayLength = 2 * skinWidth;
        }

        for (int i = 0; i < horizontalRayCount; i++)
        {
            Vector2 rayOrigin = (directionX == -1)?raycastOrigins.bottomLeft:raycastOrigins.bottomRight;
            rayOrigin += Vector2.up * (horizontalRaySpacing * i);
            RaycastHit2D hit = Physics2D.Raycast(rayOrigin, Vector2.right * directionX, rayLength, collisionMask);

            Debug.DrawRay(rayOrigin, Vector2.right * directionX, Color.red);

            if (hit)
            {
                if (hit.distance == 0)
                {
                    //continue;
                }

                if (hit.collider.CompareTag("Ignore"))
                {
                    continue;
                }

                if (hit.collider.CompareTag("Target"))
                {
                    if (hat.isCurrentlyAttached || hat.isBeingAttached)
                    {
                        continue;
                    }

                    if (hat.isBeingThrown)
                    {
                        hat.ApplyFreezeFrames(5);

                        VFXManager.instance.EmitAtPosition("Target_Explosion", 30, hit.transform.position, true);

                        PlayHitEffect(hit, Vector3.zero, hat.velocity, hat.lastVelocity);

                        Destroy(hit.collider.gameObject);

                        collisions.shouldReflect = true;
                        hat.collisionSkip        = false;
                    }
                    else
                    {
                        continue;
                    }
                }

                if (hit.transform.CompareTag("Balloon"))
                {
                    if (hat.isCurrentlyAttached || hat.isBeingAttached)
                    {
                        continue;
                    }

                    if (hat.isBeingThrown)
                    {
                        hat.ApplyFreezeFrames(5);
                        hat.owner.ApplyFreezeFrames(5);

                        VFXManager.instance.EmitAtPosition("Balloon_Explosion", 30, hit.transform.position, true);
                        VFXManager.instance.EmitAtPosition("Balloon_Lines", 1, hit.transform.position, true);

                        PlayHitEffect(hit, Vector3.zero, hat.velocity, hat.lastVelocity);

                        Destroy(hit.transform.gameObject);

                        collisions.shouldReflect = true;
                        hat.collisionSkip        = false;
                    }
                    else
                    {
                        hat.collisionSkip = true;
                        continue;
                    }
                }

                if (hit.transform.CompareTag("Icicle") && hat.collisionSkip)
                {
                    Icicle icicle = hit.transform.GetComponent <Icicle>();

                    if (hat.isBeingThrown)
                    {
                        if (icicle.isCurrentlyAttached)
                        {
                            icicle.BreakOff();
                        }

                        icicle.LoseHp();

                        collisions.shouldReflect = true;
                    }
                    else if (!hat.isCurrentlyAttached)
                    {
                        collisions.shouldReflect = true;
                    }

                    hat.collisionSkip = false;
                }

                if (hit.transform.CompareTag("TransferDanger") && hat.collisionSkip)
                {
                    if (hat.isBeingThrown)
                    {
                        hit.transform.GetComponent <TransferDanger>().Transfer(hat.velocity * 1.5f);
                    }

                    collisions.shouldReflect = true;
                    hat.collisionSkip        = false;
                }

                if (hit.transform.CompareTag("MiningCart") && hat.collisionSkip)
                {
                    if (hat.isBeingThrown)
                    {
                        int _direction = collisions.faceDir;

                        hit.transform.GetComponent <MiningCart>().MoveCart(_direction);

                        hat.AllowToComeBack();

                        if (hit.transform.GetComponent <MiningCart>().isDangerous)
                        {
                            PlayHitEffect(hit, hat.velocity, hat.velocity, oldVelocity);
                        }
                    }

                    collisions.shouldReflect = true;
                    hat.collisionSkip        = false;
                }

                if (hat.isBeingAttached && (hit.collider.CompareTag("Player") || hit.collider.CompareTag("Hat") || hit.collider.CompareTag("Lava")))
                {
                    continue;
                }
                if (hat.isBeingAttached && i == 0)
                {
                    continue;
                }

                if (hit.collider.CompareTag("Lava"))
                {
                    collisions.shouldBurn = true;

                    continue;
                }

                if (hit.collider.CompareTag("Smash Ball"))
                {
                    if (hat.isCurrentlyAttached || hat.isBeingAttached)
                    {
                        continue;
                    }

                    if (hat.isBeingThrown)
                    {
                        hat.ApplyFreezeFrames(5);
                        hat.owner.ApplyFreezeFrames(5);

                        PlayHitEffect(hit, Vector3.zero, hat.velocity, hat.lastVelocity);

                        collisions.shouldReflect = true;
                        hat.collisionSkip        = false;
                    }
                    else
                    {
                        hat.collisionSkip = true;
                        continue;
                    }
                }

                if (hit.collider.CompareTag("Player"))
                {
                    Player otherPlayer = hit.collider.GetComponent <Player>();

                    if (hat.isBeingThrown)
                    {
                        if (!otherPlayer.isInvulnerable && !hat.isHitFrozen)
                        {
                            float stunTimeModifier = (hat.hasIncreasingStunOverTime) ? hat.currentThrowTimer : 0;

                            otherPlayer.BlowBack((new Vector3(hit.point.x, hit.point.y, transform.position.z) - transform.position), hat.throwBlowBack, hat.throwStunTime + stunTimeModifier);

                            hat.ApplyFreezeFrames(5);
                            hat.owner.ApplyFreezeFrames(5);
                            otherPlayer.hat.ApplyFreezeFrames(5);
                            otherPlayer.ApplyFreezeFrames(5);

                            PlayHitEffect(hit, hit.collider.GetComponent <Player>().GetVelocity(), hat.velocity, oldVelocity);
                            collisions.isHittingPlayer = true;
                            hat.collisionSkip          = false;
                            hat.AllowToComeBack();

                            CalculateAccuracy();
                        }
                    }
                    else
                    {
                        continue;
                    }
                }

                if (hit.collider.CompareTag("Hat"))
                {
                    Hat other = hit.collider.GetComponent <Hat>();

                    if (hat.isFallingOff || other.isFallingOff || hat.isDying)
                    {
                        continue;
                    }

                    if (hat.isBeingThrown)
                    {
                        if (other.isCurrentlyAttached)
                        {
                            if (!other.owner.isInvulnerable)
                            {
                                float stunTimeModifier = (hat.hasIncreasingStunOverTime) ? hat.currentThrowTimer : 0;

                                other.owner.BlowBack((new Vector3(hit.point.x, hit.point.y, transform.position.z) - transform.position), hat.throwBlowBack, hat.throwStunTime + stunTimeModifier);

                                hat.ApplyFreezeFrames(5);
                                hat.owner.ApplyFreezeFrames(5);
                                other.ApplyFreezeFrames(5);
                                other.owner.ApplyFreezeFrames(5);

                                hit.collider.GetComponent <HatController>().collisions.hitHat = true;
                                PlayHitEffect(hit, other.velocity, hat.velocity, oldVelocity);
                                collisions.isHittingPlayer = true;
                                hat.collisionSkip          = false;
                                hat.AllowToComeBack();

                                CalculateAccuracy();
                            }
                        }
                        else if (other.isBeingThrown)
                        {
                            hit.collider.GetComponent <HatController>().collisions.hitHat = true;

                            hat.ApplyFreezeFrames(3);
                            hat.owner.ApplyFreezeFrames(3);
                            other.ApplyFreezeFrames(3);
                            other.owner.ApplyFreezeFrames(3);

                            //PlayHatHitHatEffect(hit);
                            //PlayHitEffect(hit, other.velocity, hat.velocity, hat.velocity);
                            PlayHitHatEffect(hit, hat.velocity);

                            CalculateAccuracy();
                        }

                        if (!other.isCurrentlyAttached && !other.isFallingOff && !other.isBeingThrown && !hat.isCurrentlyAttached)
                        {
                            other.KnockBack(hat.velocity, hat.velocity.magnitude * 0.8f);
                        }
                    }
                    else
                    {
                        //PlayHatHitHatEffect(hit);
                    }

                    if ((hat.isCurrentlyAttached) || (other.isCurrentlyAttached))
                    {
                        continue;
                    }

                    if (!other.isCurrentlyAttached && !other.isFallingOff && !other.isBeingThrown)
                    {
                        //other.KnockBack (hat.velocity, hat.velocity.magnitude);
                    }
                }

                moveAmount.x = (hit.distance - skinWidth) * directionX;
                rayLength    = hit.distance;

                collisions.left  = directionX == -1;
                collisions.right = directionX == 1;

                if ((collisions.right || collisions.left) && !hat.isBeingAttached)
                {
                    collisions.shouldReflect = true;
                }

                if ((collisions.right || collisions.left) && hat.isBeingThrown && !hat.owner.isStunned && hit.transform.gameObject != hat.owner.gameObject)
                {
                    hat.AllowToComeBack();
                }
            }
        }
    }
コード例 #11
0
    void VerticalCollisions(ref Vector2 moveAmount)
    {
        //if (hat.collisionSkip) return;

        Vector2 oldVelocity = hat.velocity;

        float directionY = Mathf.Sign(moveAmount.y);
        float rayLength  = Mathf.Abs(moveAmount.y) + skinWidth;

        for (int i = 0; i < verticalRayCount; i++)
        {
            Vector2 rayOrigin = (directionY == -1)?raycastOrigins.bottomLeft:raycastOrigins.topLeft;
            rayOrigin += Vector2.right * (verticalRaySpacing * i + moveAmount.x);
            RaycastHit2D[] hits = Physics2D.RaycastAll(rayOrigin, Vector2.up * directionY, rayLength, collisionMask);
            Debug.DrawRay(rayOrigin, Vector2.up * directionY, Color.red);

            for (int j = 0; j < hits.Length; j++)
            {
                if (hits[j])
                {
                    if (hits[j].collider.CompareTag("Ignore"))
                    {
                        continue;
                    }

                    if (hits[j].collider.CompareTag("Target"))
                    {
                        if (hat.isCurrentlyAttached || hat.isBeingAttached)
                        {
                            continue;
                        }

                        if (hat.isBeingThrown)
                        {
                            hat.ApplyFreezeFrames(5);
                            hat.owner.ApplyFreezeFrames(5);
                            collisions.shouldReflectY = true;

                            VFXManager.instance.EmitAtPosition("Target_Explosion", 30, hits[j].transform.position, true);

                            PlayHitEffect(hits[j], Vector3.zero, hat.velocity, hat.lastVelocity);

                            Destroy(hits[j].collider.gameObject);
                        }
                        else
                        {
                            continue;
                        }
                    }

                    if (hits[j].transform.CompareTag("Balloon"))
                    {
                        if (hat.isCurrentlyAttached || hat.isBeingAttached)
                        {
                            continue;
                        }

                        if (hat.isBeingThrown)
                        {
                            hat.ApplyFreezeFrames(5);
                            hat.owner.ApplyFreezeFrames(5);

                            collisions.shouldReflectY = true;

                            VFXManager.instance.EmitAtPosition("Balloon_Explosion", 30, hits[j].transform.position, true);
                            VFXManager.instance.EmitAtPosition("Balloon_Lines", 1, hits[j].transform.position, true);
                            PlayHitEffect(hits[j], Vector3.zero, hat.velocity, hat.lastVelocity);

                            Destroy(hits[j].transform.gameObject);
                        }
                        else
                        {
                            hat.collisionSkip = true;
                            continue;
                        }
                    }

                    if (hits[j].transform.CompareTag("Icicle") && hat.collisionSkip)
                    {
                        Icicle icicle = hits[j].transform.GetComponent <Icicle>();

                        if (hat.isBeingThrown)
                        {
                            if (icicle.isCurrentlyAttached)
                            {
                                icicle.BreakOff();
                            }

                            icicle.LoseHp();

                            collisions.shouldReflectY = true;
                        }
                        else if (!hat.isCurrentlyAttached)
                        {
                            collisions.shouldReflectY = true;
                        }

                        hat.collisionSkip = false;
                    }

                    if (hat.isBeingAttached && directionY < 0 && (hits[j].collider.CompareTag("Player") || hits[j].collider.CompareTag("Hat") || hits[j].collider.CompareTag("Lava")))
                    {
                        continue;
                    }
                    if (hat.isBeingAttached && (hits[j].collider.CompareTag("Player") || hits[j].collider.CompareTag("Hat") || hits[j].collider.CompareTag("Lava")))
                    {
                        continue;
                    }

                    if (hits[j].collider.CompareTag("Lava"))
                    {
                        collisions.shouldBurn = true;
                        continue;
                    }

                    if (hits[j].collider.CompareTag("Through"))
                    {
//						if (directionY == 1 || hits[j].distance == 0) {
//							continue;
//						}

                        if (directionY == 1)
                        {
                            continue;
                        }
                    }

                    if (hits[j].transform.CompareTag("TransferDanger") && hat.collisionSkip)
                    {
                        if (hat.isBeingThrown)
                        {
                            hits[j].transform.GetComponent <TransferDanger>().Transfer(hat.velocity);
                        }

                        collisions.shouldReflectY = true;
                        hat.collisionSkip         = false;
                    }

                    if (hits[j].collider.CompareTag("Smash Ball"))
                    {
                        if (hat.isCurrentlyAttached || hat.isBeingAttached)
                        {
                            continue;
                        }

                        if (hat.isBeingThrown)
                        {
                            hat.ApplyFreezeFrames(5);
                            hat.owner.ApplyFreezeFrames(5);

                            collisions.shouldReflectY = true;

                            //destroy
                            //gain effect
                        }
                        else
                        {
                            hat.collisionSkip = true;
                            continue;
                        }
                    }


                    if (hits[j].collider.CompareTag("Player"))
                    {
                        Player otherPlayer = hits[j].collider.GetComponent <Player>();

                        if (hat.isBeingThrown)
                        {
                            if (!otherPlayer.isInvulnerable && !hat.isHitFrozen)
                            {
                                float stunTimeModifier = (hat.hasIncreasingStunOverTime) ? hat.currentThrowTimer : 0;

                                otherPlayer.BlowBack((new Vector3(hits[j].point.x, hits[j].point.y, transform.position.z) - transform.position), hat.throwBlowBack, hat.throwStunTime + stunTimeModifier);

                                hat.ApplyFreezeFrames(5);
                                hat.owner.ApplyFreezeFrames(5);
                                otherPlayer.hat.ApplyFreezeFrames(5);
                                otherPlayer.ApplyFreezeFrames(5);

                                PlayHitEffect(hits[j], hits[j].collider.GetComponent <Player>().GetVelocity(), hat.velocity, oldVelocity);

                                hat.velocity.y = -hat.velocity.y;


                                CalculateAccuracy();
                            }
                        }
                        else
                        {
                            continue;
                        }
                    }

                    if (hits[j].collider.CompareTag("Hat"))
                    {
                        Hat    otherHat    = hits[j].collider.GetComponent <Hat>();
                        Player otherPlayer = hits[j].collider.GetComponent <Player>();

                        if (otherHat == null || otherPlayer == null)
                        {
                            return;
                        }

                        if (hat.isFallingOff || otherHat.isFallingOff || hat.isDying)
                        {
                            continue;
                        }

                        if (hat.isBeingThrown)
                        {
                            collisions.shouldReflectY = true;

                            if (otherHat.isCurrentlyAttached)
                            {
                                if (!otherHat.owner.isInvulnerable)
                                {
                                    float stunTimeModifier = (hat.hasIncreasingStunOverTime) ? hat.currentThrowTimer : 0;

                                    otherHat.owner.BlowBack((new Vector3(hits[j].point.x, hits[j].point.y, transform.position.z) - transform.position), hat.throwBlowBack, hat.throwStunTime + stunTimeModifier);
                                    hits[j].collider.GetComponent <HatController>().collisions.hitHat = true;

                                    PlayHitEffect(hits[j], otherPlayer.GetVelocity(), hat.velocity, oldVelocity);

                                    CalculateAccuracy();
                                }
                                else
                                {
                                }
                            }
                            else if (otherHat.isBeingThrown)
                            {
                                hits[j].collider.GetComponent <HatController>().collisions.hitHat = true;
                                //PlayHatHitHatEffect (hits[j]);
                                //PlayHitEffect(hits[j], otherHat.velocity, hat.velocity, hat.velocity);
                                PlayHitHatEffect(hits[j], hat.velocity);
                            }

                            if (!otherHat.isCurrentlyAttached && !otherHat.isFallingOff && !otherHat.isBeingThrown && !hat.isCurrentlyAttached)
                            {
                                otherHat.KnockBack(hat.velocity, hat.velocity.magnitude * 0.5f);
                            }

                            hat.ApplyFreezeFrames(3);
                            otherHat.ApplyFreezeFrames(3);
                            hat.owner.ApplyFreezeFrames(3);
                            otherHat.owner.ApplyFreezeFrames(3);
                        }
                        else
                        {
                            //PlayHatHitHatEffect(hits[j]);
                        }

                        if (!otherHat.isCurrentlyAttached && !otherHat.isFallingOff && !otherHat.isBeingThrown && !hat.isCurrentlyAttached)
                        {
                            //other.KnockBack(hat.velocity, hat.velocity.magnitude);
                        }

                        continue;

//						if (!other.isCurrentlyAttached && !other.isBeingThrown && !hat.isCurrentlyAttached && !hat.isBeingThrown) {
//							//other.BlowBack (hat.velocity, hat.velocity.magnitude/10);
//							//hat.velocity.y = -hat.velocity.y / 2;
//							continue;
//						}
                    }

                    moveAmount.y = (hits[j].distance - skinWidth) * directionY;
                    rayLength    = hits[j].distance;

                    if (!hits[j].collider.CompareTag("Hat") && !hits[j].collider.CompareTag("Player"))
                    {
                        collisions.below = directionY == -1;
                        collisions.above = directionY == 1;
                    }
                    else
                    {
                        hat.velocity.y = -hat.velocity.y / 2;
                    }

                    if ((collisions.above) && hat.isBeingThrown && !hat.owner.isStunned)
                    {
                        hat.AllowToComeBack();
                    }
                }
            }
        }

        if (collisions.shouldReflect)
        {
            collisions.shouldReflectY = false;
        }
    }
コード例 #12
0
    public override void Start()
    {
        base.Start();

        icicle = GetComponent <Icicle>();
    }