예제 #1
0
    public override void AttUpdate(float attackTimeLeft)
    {
        if (attackTimeLeft > attackDuration * 0.25)
        {
            sharedLineMaterial.color =
                new Color(
                    sharedLineMaterial.color.r,
                    sharedLineMaterial.color.g,
                    sharedLineMaterial.color.b,
                    Mathf.Lerp(1, 5, (attackDuration - attackTimeLeft) / (attackDuration - attackDuration * 0.25f))
                    );
            if (attackTimeLeft > attackDuration * 0.65)
            {
                linesContainer.transform.Rotate(
                    new Vector3(0, 0, rotationRNG * Time.fixedDeltaTime));
            }
            else if (attackTimeLeft <= attackDuration * 0.35)
            {
                var playersToHit = collidingPlayers.GetCollidingPlayers();

                foreach (GameObject player in playersToHit)
                {
                    if (!damagedPlayers.Contains(player))
                    {
                        damagedPlayers.Add(player);
                        mgr.InjurePlayer(player, 1);
                    }
                }
            }
        }
        else
        {
            // some action??
        }
    }
예제 #2
0
    public override void AttUpdate(float attackTimeLeft)
    {
        if (BaddyLaser && Environment())
        {
            var offset = Player.transform.position - BaddyLaser.transform.position;
            var angle  = Mathf.Atan2(offset.y, offset.x) * Mathf.Rad2Deg;
            BaddyLaser.transform.rotation = Quaternion.Euler(0, 0, angle + 180);
        }

        if (attackTimeLeft < attackDuration * 0.6)
        {
            var playersToHit = collidingPlayers.GetCollidingPlayers();

            foreach (GameObject player in playersToHit)
            {
                if (!damagedPlayers.Contains(player))
                {
                    damagedPlayers.Add(player);
                    Bmgr.InjurePlayer(player, 1);
                }
            }
            if (attackTimeLeft < attackDuration * 0.4f)
            {
                damagedPlayers.Clear();
            }
        }
        else
        {
            LaserSprite.color = new Color(LaserSprite.color.r, LaserSprite.color.g, LaserSprite.color.b, Mathf.Lerp(0, 1, (attackDuration - attackTimeLeft) / (attackDuration * 0.4f)));
            if (Environment())
            {
                BaddyLaser.transform.localScale = new Vector3(Mathf.Lerp(1f, 1.8f, (attackDuration - attackTimeLeft) / (attackDuration * 0.4f)), 1f, 1f);
            }
        }
    }