예제 #1
0
    // Use this for initialization
    void Start()
    {
        MethodInfo[] methods = this.GetType().GetMethods(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
        foreach (MethodInfo m in methods)
        {
            Subscribe[] subs = (Subscribe[])m.GetCustomAttributes(typeof(Subscribe), true);
            if (subs != null && subs.Length > 0)
            {
                NotifierManager.registerNotification(subs[0].GetSubscription(), Delegate.CreateDelegate(typeof(Action <Notification>), this, m.Name) as Action <Notification>);
            }
        }

        eneymyBirthNum   = 1;
        eneymyBirthCount = 1;
        randomBirthRect  = new Rect(birthPlaceMin.transform.position.x, birthPlaceMin.transform.position.y, birthPlaceMax.transform.position.x - birthPlaceMin.transform.position.x, birthPlaceMax.transform.position.y - birthPlaceMin.transform.position.y);
    }
예제 #2
0
    void CheckAttackTarget(Collider other)
    {
        if (other.transform.tag == "Sword")
        {
            var playerEntity = other.gameObject.GetComponentInParent <PlayerEntity>();

            if (playerEntity != null)
            {
                if (playerEntity.stateInfo.IsName("handRun"))
                {
                    return;
                }
            }
            testHpBar.gameObject.SetActive(false);
            var skinnedVoxelExplosion = this.GetComponent <VoxelSkinnedAnimationObjectExplosion>();
            if (skinnedVoxelExplosion != null)
            {
                if (!skinnedVoxelExplosion.enabled)
                {
                    var collider = this;
                    collider.enabled = false;

                    skinnedVoxelExplosion.SetExplosionCenter(skinnedVoxelExplosion.transform.worldToLocalMatrix.MultiplyPoint3x4(transform.position));

                    var animator        = collider.GetComponent <Animator>();
                    var animatorEnabled = false;
                    if (animator != null)
                    {
                        animatorEnabled  = animator.enabled;
                        animator.enabled = false;
                    }
                    skinnedVoxelExplosion.BakeExplosionPlay(lifeTime, () =>
                    {
                        Destroy(skinnedVoxelExplosion.gameObject);
                        NotifierManager.SendNotification(PublicEnum.NotifierSendType.EnemyDie);
                    });
                }
            }
        }
    }