コード例 #1
0
        override public void UpdateAbility(CharacterState characterState, Animator animator, AnimatorStateInfo stateInfo)
        {
            CharacterControl control = characterState.GetCharacterControl(animator);

            if (stateInfo.normalizedTime >= CheckTime)
            {
                if (IsGrounded(control))
                {
                    animator.SetBool(TransitionParameter.Grounded.ToString(), true);
                }
                else
                {
                    animator.SetBool(TransitionParameter.Grounded.ToString(), false);
                }
            }
        }
コード例 #2
0
        public override void UpdateAbility(CharacterState characterState, Animator animator, AnimatorStateInfo stateInfo)
        {
            CharacterControl control = characterState.GetCharacterControl(animator);


            if (control.Jump)
            {
                animator.SetBool(TransitionParameter.Jump.ToString(), true);
                if (control.MoveRight || control.MoveLeft)
                {
                    animator.SetBool(TransitionParameter.JumpForward.ToString(), true);
                }
            }

            if (control.Crouch)
            {
                animator.SetBool(TransitionParameter.Crouch.ToString(), true);
            }
            else if (!control.Crouch)
            {
                animator.SetBool(TransitionParameter.Crouch.ToString(), false);
            }

            if (control.Dash && !animator.GetBool("Jump"))
            {
                animator.SetBool(TransitionParameter.Dash.ToString(), true);
            }
            else if (!control.Crouch)
            {
                animator.SetBool(TransitionParameter.Dash.ToString(), false);
            }

            if (Constant)
            {
                ConstantMove(control, animator, stateInfo);
            }
            else
            {
                ControlledMove(control, animator, stateInfo);
            }

            if (control.Attack_Normal)
            {
                animator.SetBool(TransitionParameter.Attack.ToString(), true);
            }
        }
コード例 #3
0
        override public void UpdateAbility(CharacterState characterState, Animator animator, AnimatorStateInfo stateInfo)
        {
            CharacterControl control = CharacterManager.Instance.GetCharacter(animator);

            if (!control.Crouch)
            {
                animator.SetBool(TransitionParameter.Crouch.ToString(), false);
            }
            else if (control.Crouch)
            {
                animator.SetBool(TransitionParameter.Crouch.ToString(), true);
            }

            if (control.Spell)
            {
                animator.SetBool(SpellTypeParameters.Hadoken.ToString(), true);
            }
        }
コード例 #4
0
 bool CheckFront(CharacterControl control)
 {
     foreach (GameObject o in control.FrontSpheres)
     {
         Debug.DrawRay(o.transform.position, control.transform.forward * BlockDistance, Color.yellow);
         RaycastHit hit;
         if (Physics.Raycast(o.transform.position, control.transform.forward, out hit, BlockDistance))
         {
             if (!control.RagdollParts.Contains(hit.collider))
             {
                 if (!IsBodyPart(hit.collider) && !Edge.IsEdge(hit.collider.gameObject) && !Edge.IsEdgeChecker(hit.collider.gameObject))
                 {
                     return(true);
                 }
             }
         }
     }
     return(false);
 }
コード例 #5
0
        public void TakeDamage(BulletInfo info)
        {
            CameraManager.Instance.ShakeCamera(0.25f);

            //Debug.Log(info.Attacker.gameObject.name + " hits " + this.gameObject.name);
            //Debug.Log(this.gameObject.name + " hit " + DamagePart.ToString());
            //control.SkinnedMeshAnimator.runtimeAnimatorController = info.attackAbility.GetDeathAnimator();

            info.CurrentHits++;
            CharacterControl control = GetComponent <CharacterControl>();

            control.currentHP -= info.damageAmount;
            if (info.hitSound)
            {
                audioSource.clip = info.hitSound;
                audioSource.Play();
            }
            if (control.currentHP <= 0)
            {
                control.SkinnedMeshAnimator.runtimeAnimatorController = DeathAnimationManager.Instance.GetAnimator(DamagePart, info);
                alive = false;
                boxCollider.enabled           = false;
                control.RIGID_BODY.useGravity = false;
                if (control.edgeChecker)
                {
                    control.edgeChecker.GetComponent <BoxCollider>().enabled = false;
                }
                uIController.StartCoroutine(uIController.HideEnemyPanel());
                if (tag == "Enemy")
                {
                    botManager.currentEnemyAmount -= 1;
                }
            }
            else
            {
                control.SkinnedMeshAnimator.runtimeAnimatorController = DeathAnimationManager.Instance.GetHittedAnimator();
            }
            if (tag == "Enemy")
            {
                uIController.UpdateEnemyUI(control);
            }
        }
コード例 #6
0
        bool IsBodyPart(Collider col)
        {
            CharacterControl control = col.transform.root.GetComponent <CharacterControl>();

            if (control == null)
            {
                return(false);
            }

            if (control.gameObject == col.gameObject)
            {
                return(false);
            }

            if (control.RagdollParts.Contains(col))
            {
                return(true);
            }
            return(false);
        }
コード例 #7
0
        private void ControlledMove(CharacterControl control, Animator animator, AnimatorStateInfo stateInfo)
        {
            if (control.MoveRight && control.MoveLeft)
            {
                animator.SetBool(TransitionParameter.Move.ToString(), false);
                return;
            }

            if (!control.MoveRight && !control.MoveLeft)
            {
                animator.SetBool(TransitionParameter.Move.ToString(), false);
                return;
            }
            if (control.Spell)
            {
                animator.SetBool(SpellTypeParameters.Hadoken.ToString(), true);
            }

            if (control.Attack_Normal)
            {
                animator.SetBool(TransitionParameter.Attack.ToString(), true);
            }

            if (control.MoveRight)
            {
                control.transform.rotation = Quaternion.Euler(0f, 0f, 0f);
                if (!CheckFront(control))
                {
                    control.MoveForward(speed, SpeedGraph.Evaluate(stateInfo.normalizedTime));
                }
            }

            if (control.MoveLeft)
            {
                control.transform.rotation = Quaternion.Euler(0f, 180f, 0f);
                if (!CheckFront(control))
                {
                    control.MoveForward(speed, SpeedGraph.Evaluate(stateInfo.normalizedTime));
                }
            }
        }
コード例 #8
0
        public void SpawnObject(CharacterControl control)
        {
            if (control.animationProgress.PoolObjectList.Contains(ObjectType))
            {
                return;
            }

            GameObject obj = PoolManager.Instance.GetObject(ObjectType);

            if (!string.IsNullOrEmpty(ParentObjectName))
            {
                GameObject p = control.GetChildObj(ParentObjectName);
                obj.transform.transform.parent = p.transform;
                obj.transform.localPosition    = Vector3.zero;
                obj.transform.localRotation    = Quaternion.identity;
            }
            if (!StickToParent)
            {
                obj.transform.parent = null;
            }

            obj.SetActive(true);
            control.animationProgress.PoolObjectList.Add(ObjectType);
        }
コード例 #9
0
        private void OnTriggerEnter(Collider col)
        {
            if (owner.RagdollParts.Contains(col))
            {
                return;
            }

            CharacterControl attacker = col.transform.root.GetComponent <CharacterControl>();

            if (attacker == null)
            {
                return;
            }

            if (col.gameObject == attacker.gameObject)
            {
                return;
            }

            if (!CollidingParts.Contains(col))
            {
                CollidingParts.Add(col);
            }
        }
コード例 #10
0
        bool IsGrounded(CharacterControl control)
        {
            if (control.RIGID_BODY.velocity.y >= -0.001f && control.RIGID_BODY.velocity.y <= 0f)
            {
                return(true);
            }

            if (control.RIGID_BODY.velocity.y < 0f)
            {
                foreach (GameObject o in control.BottomSpheres)
                {
                    Debug.DrawRay(o.transform.position, -Vector3.up * Distance, Color.yellow);
                    RaycastHit hit;
                    if (Physics.Raycast(o.transform.position, -Vector3.up, out hit, Distance))
                    {
                        if (!control.RagdollParts.Contains(hit.collider) && !Edge.IsEdge(hit.collider.gameObject) && !Edge.IsEdgeChecker(hit.collider.gameObject))
                        {
                            return(true);
                        }
                    }
                }
            }
            return(false);
        }
コード例 #11
0
 public void GetOwner(CharacterControl _owner)
 {
     owner = _owner;
 }
コード例 #12
0
 private void ToggleColiider(CharacterControl control)
 {
     control.RIGID_BODY.velocity = Vector3.zero;
     control.GetComponent <BoxCollider>().enabled = On;
 }
コード例 #13
0
        public override void OnEnter(CharacterState characterState, Animator animator, AnimatorStateInfo stateInfo)
        {
            CharacterControl control = characterState.GetCharacterControl(animator);

            control.SkinnedMeshAnimator.applyRootMotion = true;
        }
コード例 #14
0
        public override void OnExit(CharacterState characterState, Animator animator, AnimatorStateInfo stateInfo)
        {
            CharacterControl control = CharacterManager.Instance.GetCharacter(animator);

            control.edgeChecker.GrabbedEdge = null;
        }
コード例 #15
0
 private void Awake()
 {
     owner = this.GetComponentInParent <CharacterControl>();
 }
コード例 #16
0
        private bool MakeTransition(CharacterControl control)
        {
            foreach (TransitionConditionType c in transitionConditions)
            {
                switch (c)
                {
                case TransitionConditionType.UP: {
                    if (!control.MoveUp)
                    {
                        return(false);
                    }
                }
                break;

                case TransitionConditionType.DOWN:
                {
                    if (!control.MoveDown)
                    {
                        return(false);
                    }
                }
                break;

                case TransitionConditionType.RIGHT:
                {
                    if (!control.MoveRight)
                    {
                        return(false);
                    }
                }
                break;

                case TransitionConditionType.LEFT:
                {
                    if (!control.MoveLeft)
                    {
                        return(false);
                    }
                }
                break;

                case TransitionConditionType.ATTACK:
                {
                    if (!control.Attack)
                    {
                        return(false);
                    }
                }
                break;

                case TransitionConditionType.JUMP:
                {
                    if (!control.Jump)
                    {
                        return(false);
                    }
                }
                break;

                case TransitionConditionType.GRABBING_LEDGE:
                {
                    if (!control.edgeChecker.IsGrabbingEdge)
                    {
                        return(false);
                    }
                }
                break;
                }
            }
            return(true);
        }
コード例 #17
0
 private void Awake()
 {
     characterControl = this.gameObject.GetComponent <CharacterControl>();
 }
コード例 #18
0
 // Start is called before the first frame update
 void Start()
 {
     player            = CharacterManager.Instance.GetPlayer();
     playerIcon.sprite = player.icon;
 }
コード例 #19
0
ファイル: Idle.cs プロジェクト: loveqxl/CodesCollection
        override public void UpdateAbility(CharacterState characterState, Animator animator, AnimatorStateInfo stateInfo)
        {
            CharacterControl control = characterState.GetCharacterControl(animator);

            if (control.MoveRight && control.MoveLeft)
            {
                animator.SetBool(TransitionParameter.Move.ToString(), false);
                return;
            }

            if (control.Spell)
            {
                animator.SetBool(SpellTypeParameters.Hadoken.ToString(), true);
            }
            else
            {
                animator.SetBool(SpellTypeParameters.Hadoken.ToString(), false);
            }

            if (control.Attack_Normal)
            {
                animator.SetBool(TransitionParameter.Attack.ToString(), true);
            }

            if (control.Jump)
            {
                animator.SetBool(TransitionParameter.Jump.ToString(), true);
                if (control.JumpForward)
                {
                    animator.SetBool(TransitionParameter.JumpForward.ToString(), true);
                }
            }


            if (control.Crouch)
            {
                animator.SetBool(TransitionParameter.Crouch.ToString(), true);
            }
            else if (!control.Crouch)
            {
                animator.SetBool(TransitionParameter.Crouch.ToString(), false);
            }

            if (control.Dash)
            {
                animator.SetBool(SpellTypeParameters.Dash.ToString(), true);
            }
            else if (!control.Crouch)
            {
                animator.SetBool(SpellTypeParameters.Dash.ToString(), false);
            }

            if (control.MoveRight)
            {
                animator.SetBool(TransitionParameter.Move.ToString(), true);
            }

            if (control.MoveLeft)
            {
                animator.SetBool(TransitionParameter.Move.ToString(), true);
            }
        }
コード例 #20
0
 private void ToggleGrav(CharacterControl control)
 {
     control.RIGID_BODY.velocity   = Vector3.zero;
     control.RIGID_BODY.useGravity = On;
 }