private void OnTriggerEnter(Collider other)
    {
        if (other.CompareTag("Player"))
        {
            FSMPlayer player = other.GetComponent <FSMPlayer>();

            if (player != null)
            {
                if (player.IsAvoid())
                {
                    return;
                }
                if (player.IsDead())
                {
                    return;
                }
                if (player.IsInvicibility)
                {
                    return;
                }

                if (Name != null)
                {
                    MemoryPoolManager.Instance.CreateObject(Name, transform);
                }

                player.TakeDamage(AttackDamage);

                this.gameObject.SetActive(false);
            }
        }

        //For Plasma
        if (isGroundCollision)
        {
            if (other.gameObject.layer == 8)
            {
                MemoryPoolManager.Instance.CreateObject("Plasma", transform);
                this.gameObject.SetActive(false);
            }
        }
    }
Beispiel #2
0
    private bool CommonSkill(int index, bool isRaycast, bool isPlayingWhirlwind = false)
    {
        if (player.IsThrowAxe())
        {
            return(false);
        }
        if (player.IsAvoid())
        {
            return(false);
        }
        if (player.IsBuff())
        {
            return(false);
        }
        if (player.IsDash())
        {
            return(false);
        }
        if (player.IsBash())
        {
            return(false);
        }
        if (player.IsWhirlwind())
        {
            return(false);
        }
        if (UIManager.Instance.CoolTimes[index].fillAmount > 0)
        {
            return(false);
        }

        if (!player.IsWeaponEquiped)
        {
            player.EquipWeapon(true);
        }

        if (isRaycast)
        {
            Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit HitInfo;

            if (Physics.Raycast(ray, out HitInfo, 100f, player.Layer))
            {
                Vector3 dest = HitInfo.point;

                player.Point.transform.position = dest;

                if (player.Point.parent)
                {
                    player.ChangeShader(player.Point.parent.GetComponentsInChildren <SkinnedMeshRenderer>(), "Custom/DissolveShader");
                    player.Point.parent = null;
                }
            }
            else
            {
                return(false);
            }
        }

        if (isPlayingWhirlwind == false)
        {
            UIManager.Instance.CoolTimes[index].fillAmount = 1;
            StartCoroutine(UIManager.Instance.SkillCoolTime(index));
        }

        return(true);
    }