コード例 #1
0
ファイル: Cuttable.cs プロジェクト: pjanek935/burinkeru
 void onHitterActivated(ActivatableHitter hitter, Hashtable parameters)
 {
     if (hitter.HitterType == HitterType.BLADE)
     {
         cut(hitter.transform);
     }
 }
コード例 #2
0
ファイル: Bullet.cs プロジェクト: pjanek935/burinkeru
 void onHitterActivated(ActivatableHitter activatableHitter, Hashtable parameters)
 {
     if (activatableHitter.HitterType == HitterType.BLADE)
     {
         this.transform.forward = -this.transform.forward;
         setSpeed();
     }
 }
コード例 #3
0
ファイル: Hittable.cs プロジェクト: pjanek935/burinkeru
    void onHitterActivated(ActivatableHitter hitter, Hashtable parameters)
    {
        OnHitterActivated?.Invoke(hitter, parameters);

        if (sendMessageEnabled)
        {
            Hashtable feedbackParameters = new Hashtable();
            feedbackParameters.Add(ParameterType.SENDER_TYPE, senderType);
            hitter.SendMessage(feedbackParameters);
        }
    }
コード例 #4
0
ファイル: Hittable.cs プロジェクト: pjanek935/burinkeru
    private void OnTriggerExit(Collider other)
    {
        Hitter hitter = other.transform.gameObject.GetComponent <Hitter>();

        if (hitter != null)
        {
            OnHitterExit?.Invoke(hitter);

            if (hitter is ActivatableHitter)
            {
                ActivatableHitter activatableHitter = (ActivatableHitter)hitter;

                if (registeredHitters.Contains(activatableHitter))
                {
                    activatableHitter.OnActivate -= onHitterActivated;
                    int index = registeredHitters.IndexOf(activatableHitter);
                    registeredHitters.RemoveAt(index);
                }
            }
        }
    }
コード例 #5
0
ファイル: Hittable.cs プロジェクト: pjanek935/burinkeru
    private void OnTriggerEnter(Collider other)
    {
        Hitter hitter = other.transform.gameObject.GetComponent <Hitter>();

        if (hitter != null && hitter.gameObject.activeInHierarchy)
        {
            OnHitterEnter?.Invoke(hitter);

            if (hitter.GetType() == typeof(ActivatableHitter))
            {
                ActivatableHitter activatableHitter = (ActivatableHitter)hitter;

                if (activatableHitter.IsActive)
                {
                    onHitterActivated(activatableHitter, activatableHitter.LastParameters);
                }
                else if (!registeredHitters.Contains(activatableHitter))
                {
                    activatableHitter.OnActivate += onHitterActivated;
                    registeredHitters.Add(activatableHitter);
                }
            }
        }
    }
コード例 #6
0
ファイル: NPCController.cs プロジェクト: pjanek935/burinkeru
    void onHitterActivated(ActivatableHitter hitter, Hashtable parameters)
    {
        if (!IsGrounded)
        {
            Vector3 velocity = this.Velocity;
            velocity.y = 5.5f;
            SetVelocity(velocity);
        }

        if (hitter != null && hitter.HitterType == HitterType.BLADE)
        {
            if (parameters != null && parameters.ContainsKey(ParameterType.ATTACK_TYPE))
            {
                WeaponActionType attackType         = (WeaponActionType)parameters [ParameterType.ATTACK_TYPE];
                Hashtable        feedbackParameters = new Hashtable();
                feedbackParameters.Add(ParameterType.SENDER_TYPE, SenderType.NPC);

                if (mainMovementState != null &&
                    mainMovementState is NPCGroundState &&
                    Random.value < 0.1f &&
                    attackType != WeaponActionType.DOWNWARD_SMASH)
                {
                    attackType = WeaponActionType.BLOCK;
                    feedbackParameters.Add(ParameterType.ATTACK_TYPE, WeaponActionType.BLOCK);
                }

                hitter.SendMessage(feedbackParameters);

                switch (attackType)
                {
                case WeaponActionType.SLASH:

                    onHit(hitter);

                    break;

                case WeaponActionType.UPPERCUT:

                    upperCut();

                    break;

                case WeaponActionType.STAB:

                    stab();

                    break;

                case WeaponActionType.BLOCK:

                    block();

                    break;

                case WeaponActionType.DOWNWARD_SMASH:

                    smashed();

                    break;
                }
            }
        }
    }