コード例 #1
0
        public bool IsGrabbingLedge()
        {
            if (characterData == null)
            {
                return(false);
            }

            if (characterData.characterMovementData.MoveUp == true)
            {
                TouchDetector t = characterStateController.characterData.GetTouchDetector(TouchDetectorType.TOP_FRONT);
                if (t != null)
                {
                    if (t.TouchablesDictionary.ContainsKey(TouchableType.LEDGE))
                    {
                        if (t.TouchablesDictionary[TouchableType.LEDGE].Count > 0)
                        {
                            foreach (Touchable touchable in t.TouchablesDictionary[TouchableType.LEDGE])
                            {
                                GrabbedLedge = touchable.gameObject.GetComponent <Ledge> ();
                                return(true);
                            }
                        }
                    }
                }
            }

            return(false);
        }
コード例 #2
0
        public bool CanMoveThrough(TouchDetectorType touchDetectorType)
        {
            if (controlMechanism.controlType == ControlType.ENEMY)
            {
                return(true);
            }

            if (TouchDetectors.ContainsKey(touchDetectorType))
            {
                TouchDetector t = TouchDetectors[touchDetectorType];
                if (t.IsTouching)
                {
                    foreach (GameObject obj in t.GeneralObjects)
                    {
                        if (obj.name.Contains("Enemy"))
                        {
                            if (controlMechanism.characterStateController.CurrentState.GetType() != typeof(PlayerRunningSlide))
                            {
                                AIControl ai = obj.GetComponent <AIControl>();
                                if (!ai.IsDead())
                                {
                                    return(false);
                                }
                            }
                        }
                        else
                        {
                            return(false);
                        }
                    }
                }
            }
            return(true);
        }
コード例 #3
0
        public bool TriggerCollateralDamage()
        {
            if (StopDetecting)
            {
                return(false);
            }

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

            if (characterData.TouchDetectors.ContainsKey(TouchDetectorType.CHARACTER_DETECTOR_BODY))
            {
                TouchDetector d = characterData.TouchDetectors[TouchDetectorType.CHARACTER_DETECTOR_BODY];
                if (d.IsTouching)
                {
                    if (d.TouchablesDictionary.ContainsKey(TouchableType.CHARACTER))
                    {
                        List <Touchable> touchables = d.TouchablesDictionary[TouchableType.CHARACTER];
                        foreach (Touchable touchable in touchables)
                        {
                            if (touchable.gameObject.name.Contains("Enemy"))
                            {
                                //Debug.Log("touch: " + touchable.gameObject.name);
                                AIControl aiControl = touchable.controlMechanism as AIControl;
                                if (!CollateralAIs.Contains(aiControl))
                                {
                                    CollateralAIs.Add(aiControl);
                                    aiControl.characterStateController.ForceDeath = true;
                                    aiControl.characterStateController.DeathCause = "Collateral";

                                    if (controlMechanism.IsFacingForward())
                                    {
                                        aiControl.transform.rotation = Quaternion.Euler(new Vector3(0f, 0f, 0f));
                                    }
                                    else
                                    {
                                        aiControl.transform.rotation = Quaternion.Euler(new Vector3(0f, 180f, 0f));
                                    }

                                    return(true);
                                }
                                else
                                {
                                    return(false);
                                }
                            }
                        }
                    }
                }
            }
            return(false);
        }
コード例 #4
0
 public bool IsTouchingGeneralObject(TouchDetectorType touchDetectorType)
 {
     if (TouchDetectors.ContainsKey(touchDetectorType))
     {
         TouchDetector t = TouchDetectors[touchDetectorType];
         if (t.IsTouching)
         {
             if (t.GeneralObjects.Count > 0)
             {
                 return(true);
             }
         }
     }
     return(false);
 }
コード例 #5
0
        void OnTriggerExit(Collider col)
        {
            TouchDetector det = col.GetComponent <TouchDetector> ();

            if (det != null)
            {
                if (det.touchDetectorType == TouchDetectorType.WAY_POINT_DETECTOR)
                {
                    TurnOnDefaultColor();
                    //if (det.controlMechanism.controlType == ControlType.PLAYER) {
                    //Debug.Log ("exited: " + this.gameObject.name);
                    //}
                }
            }
        }
コード例 #6
0
 public bool UpdateHit(TouchDetectorType touchDetectorType, ref ControlMechanism target)
 {
     if (IsWithinAttackTime())
     {
         TouchDetector detector  = characterData.GetTouchDetector(touchDetectorType);
         Touchable     touchable = GetFirstTouch(detector, TouchableType.CHARACTER);
         if (touchable != null)
         {
             touchable.controlMechanism.characterStateController.TakeHit(controlMechanism, characterData.characterAnimationData.DesignatedAnimation);
             target = touchable.controlMechanism;
             return(true);
         }
     }
     return(false);
 }
コード例 #7
0
 public bool IsTouchingPlayer(TouchDetectorType touchDetectorType)
 {
     if (TouchDetectors.ContainsKey(touchDetectorType))
     {
         TouchDetector t = TouchDetectors[touchDetectorType];
         if (t.IsTouching)
         {
             foreach (GameObject obj in t.GeneralObjects)
             {
                 if (obj.name.Contains("Player"))
                 {
                     return(true);
                 }
             }
         }
     }
     return(false);
 }
コード例 #8
0
        Touchable GetFirstTouch(TouchDetector targetTouchDetector, TouchableType touchableType)
        {
            if (targetTouchDetector == null)
            {
                return(null);
            }

            if (targetTouchDetector.TouchablesDictionary.ContainsKey(touchableType))
            {
                if (targetTouchDetector.TouchablesDictionary[touchableType].Count > 0)
                {
                    foreach (Touchable touchable in targetTouchDetector.TouchablesDictionary[TouchableType.CHARACTER])
                    {
                        return(touchable);
                    }
                }
            }

            return(null);
        }
コード例 #9
0
        public void UpdatePathStatus()
        {
            if (TargetPath.Count == 0)
            {
                return;
            }

            TouchDetector t = characterStateController.characterData.GetTouchDetector(TouchDetectorType.WAY_POINT_DETECTOR);

            if (t.TouchablesDictionary.ContainsKey(TouchableType.WAYPOINT))
            {
                foreach (Touchable touchable in t.TouchablesDictionary[TouchableType.WAYPOINT])
                {
                    if (touchable.gameObject.GetComponent <WayPoint>() == TargetPath[TargetPath.Count - 1])
                    {
                        TargetPath.RemoveAt(TargetPath.Count - 1);
                        PathUpdateCount++;
                        //Debug.Log("updating path: " + PathUpdateCount.ToString());
                        return;
                    }
                }
            }
        }
コード例 #10
0
        void OnTriggerEnter(Collider col)
        {
            TouchDetector det = col.GetComponent <TouchDetector> ();

            if (det != null)
            {
                if (det.touchDetectorType == TouchDetectorType.WAY_POINT_DETECTOR)
                {
                    if (det.controlMechanism.moveData != null)
                    {
                        det.controlMechanism.moveData.LastWayPoint = this;
                        if (det.controlMechanism.controlType == ControlType.PLAYER)
                        {
                            TurnOnPlayerColor();
                        }
                        else if (det.controlMechanism.controlType == ControlType.ENEMY)
                        {
                            TurnOnEnemyColor();
                        }
                    }
                }
            }
        }