示例#1
0
    public void SetupFirstWord(CreatureRoot val)
    {
        _ObjectHealth = ListOfWords.GetRandomWords((int)val.Stats.WordDifficulty);
        _OriginalWord = _ObjectHealth;

        val.GetCreatureWordCheckInfo().TextElement.text = _ObjectHealth;
    }
    public override void SetMethod(CreatureRoot manager)
    {
        _MyObject        = manager;
        MyAnimator       = GetComponent <Animator> ();
        transform.parent = _MyObject.transform.Find("GFX");

        for (int t = 0; t < _MyObject.GetAbilityInfo().tes.Count; t++)                                 //Goint Through The Transitions To Find This Spell Transition
        {
            for (int g = 0; g < _MyObject.GetAbilityInfo().tes [t].AllAbilities.Length; g++)           //Going Through This Spells Transition To Find The Spell
            {
                if (_MyObject.GetAbilityInfo().tes [t].AllAbilities [g].SpellRef.bulletID == bulletID) //If SpellRef ID == This SpellID. Then This Is That Spell
                {
                    test [0] = _MyObject.GetAbilityInfo().tes [t].AllAbilities [g];
                }
            }
        }

        transform.localPosition = Quaternion.Euler(0, transform.parent.rotation.y, transform.parent.rotation.z) * test [0].SpawnPosition;         //Setting The Start Location

        if ((_MyObject.GetWhatToTarget().MyMovementTarget.transform.position - transform.position).y < 0)
        {
            transform.rotation = Quaternion.Euler(0, 0, Vector3.Angle(Vector3.right, (_MyObject.GetWhatToTarget().MyMovementTarget.transform.position - transform.position)) * -1);
        }
        else
        {
            transform.rotation = Quaternion.Euler(0, 0, Vector3.Angle(Vector3.right, (_MyObject.GetWhatToTarget().MyMovementTarget.transform.position - transform.position)));
        }
    }
示例#3
0
    public void SearchAfterTarget(Vector3 myPos)
    {
        for (int i = 0; i < TargetHierarchy.Length; i++)          //Going Through The TargetHierarchy List.

        {
            _Targets = GameObject.FindGameObjectsWithTag(TargetHierarchy [i]);             //If Not Null Then There Are Objects In The Scene That Have The Desierd Tag

            if (_Targets.Length > 0)
            {
                _Closest = _Targets [0];
                for (int j = 1; j < _Targets.Length; j++)
                {
                    if (Vector3.Distance(myPos, _Closest.transform.position) > Vector3.Distance(myPos, _Targets [j].transform.position))                        //Going Through The Objects Found And Targets The Closes
                    {
                        _Closest = _Targets [j];
                    }
                }
                MyMovementTarget = _Closest.GetComponent <ObjectNodeInfo> ();
                MyAttackTarget   = _Closest.GetComponent <CreatureRoot> ();
                if (MyAttackTarget == null)
                {
                    AttackClass = false;
                }
                else
                {
                    AttackClass = true;
                }
                return;
            }
        }
    }
示例#4
0
 public override void SetMethod(CreatureRoot manager)
 {
     _MyObject = manager;
     for (int t = 0; t < _MyObject.GetAbilityInfo().tes.Count; t++)                                 //Goint Through The Transitions To Find This Spell Transition
     {
         for (int g = 0; g < _MyObject.GetAbilityInfo().tes [t].AllAbilities.Length; g++)           //Going Through This Spells Transition To Find The Spell
         {
             if (_MyObject.GetAbilityInfo().tes [t].AllAbilities [g].SpellRef.bulletID == bulletID) //If SpellRef ID == This SpellID. Then This Is That Spell
             {
                 savedDmg = _MyObject.GetAbilityInfo().tes [t].AllAbilities [g].SpellVariables[0];
             }
         }
     }
 }
示例#5
0
 void OnCollisionEnter2D(Collision2D col)     //objects with rigidbody and box2d ontrigger false
 {
     if (_MyObject.gameObject != col.gameObject)
     {
         targets = col.gameObject.GetComponent <CreatureRoot> ();
         if (targets != null)
         {
             if (targets.Stats.HealthImmunity == false && targets.Stats.TotalImmunity == false)
             {
                 if (savedDmg * (1 - targets.Stats.PhysicalResistence) > 0)                      //If The Creature Have Resist > 1 Then The Attack Will Heal The Creature. Fire On Fire Might Heal?
                 {
                     targets.TookDmg(Mathf.CeilToInt(savedDmg * (1 - targets.Stats.PhysicalResistence)));
                 }
             }
         }
     }
 }
示例#6
0
 public override int RunCriteriaCheck(CreatureRoot objectChecking)     //This Return 'True' (Which Is AnimatorState Number) If All Criteria To Start Is Met.
 {
     if (Vector3.Distance(objectChecking.transform.position, objectChecking.GetWhatToTarget().MyMovementTarget.transform.position) < DistanceToTarget)
     {
         if (objectChecking.GetAnimatorVariables().AnimatorStage == 0)
         {
             return(1);
         }
         else
         {
             return(0);
         }
     }
     else
     {
         return(0);
     }
 }
 public override int RunCriteriaCheck(CreatureRoot objectChecking)     //This Return True If All Criteria To Start Is Met.
 {
     if (Vector3.Distance(objectChecking.transform.position, objectChecking.GetWhatToTarget().MyMovementTarget.transform.position) < DistanceToTarget)
     {
         if (Physics2D.LinecastAll(objectChecking.transform.position, objectChecking.GetWhatToTarget().MyMovementTarget.transform.position, WhatToNotGoThrough).Length == 0)
         {
             if (objectChecking.GetAnimatorVariables().AnimatorStage == 0)
             {
                 return(2);
             }
         }
         return(0);
     }
     else
     {
         return(0);
     }
 }
    void Start()
    {
        myinfo      = transform.parent.parent.GetComponent <CreatureRoot> ();
        myScale     = HealthSprite.transform.localScale;
        MyPosition  = HealthSprite.transform.localPosition;
        SpriteWidth = HealthSprite.size;

        if (WhichDisplayType == HealthDisplayType.Testing1 || WhichDisplayType == HealthDisplayType.Testing3)
        {
        }
        else
        {
            HealthSprite2.enabled = false;

            MaxHP       = myinfo.Stats.Health;
            ShieldXPos  = HealthSprite2.transform.localPosition;
            ShieldWidth = HealthSprite2.size;
        }
    }
示例#9
0
    public override void SetMethod(CreatureRoot manager)
    {
        _MyObject        = manager;
        transform.parent = _MyObject.transform.Find("GFX");

        for (int t = 0; t < _MyObject.GetAbilityInfo().tes.Count; t++)                                 //Goint Through The Transitions To Find This Spell Transition
        {
            for (int g = 0; g < _MyObject.GetAbilityInfo().tes [t].AllAbilities.Length; g++)           //Going Through This Spells Transition To Find The Spell
            {
                if (_MyObject.GetAbilityInfo().tes [t].AllAbilities [g].SpellRef.bulletID == bulletID) //If SpellRef ID == This SpellID. Then This Is That Spell
                {
                    test [0] = _MyObject.GetAbilityInfo().tes [t].AllAbilities [g];
                }
            }
        }

        transform.localPosition = Quaternion.Euler(0, transform.parent.rotation.y, transform.parent.rotation.z) * test [0].SpawnPosition;         //Setting The Start Location
        timeLeft = ClockTest.TheTimes + test[0].SpellVariables[5];
    }
示例#10
0
    void FixedUpdate()                                                                                                                                         //Only Here For One Update, If Nothing Is Hit, The 'Spell' Is Destroyed
    {
        foreach (RaycastHit2D s in Physics2D.CapsuleCastAll(transform.position, TheCapsuleSize, CapsuleDirection2D.Vertical, 0, Vector2.zero, 0, WhatCanIHit)) //Capsule size is acting weird. the y value is the radius of the height, but the x value is the diameter of the width?????? WHAT why......

        {
            targets = s.transform.GetComponent <CreatureRoot> ();
            if (targets != null)
            {
                if (targets.Stats.HealthImmunity == false && targets.Stats.TotalImmunity == false)
                {
                    if (dmg * (1 - targets.Stats.PhysicalResistence) > 0)                      //If The Creature Have Resist > 1 Then The Attack Will Heal The Creature. Fire On Fire Might Heal?
                    {
                        targets.TookDmg(Mathf.CeilToInt(dmg * (1 - targets.Stats.PhysicalResistence)));
                    }
                }
            }
        }

        Destroy(gameObject);
    }
    public override void SetMethod(CreatureRoot objectChecking)
    {
        /*	_MyObject = objectChecking;
         *      parentRotaitons = _MyObject.transform.Find("GFX").rotation;
         *
         *      for (int t = 0; t < _MyObject.MyAbilityInfo.tes.Count; t++) {//Goint Through The Transitions To Find This Spell Transition
         *              for (int g = 0; g < _MyObject.MyAbilityInfo.tes [t].AllAbilities.Length; g++) {//Going Through This Spells Transition To Find The Spell
         *                      if (_MyObject.MyAbilityInfo.tes [t].AllAbilities [g].SpellRef.bulletID == bulletID) {//If SpellRef ID == This SpellID. Then This Is That Spell
         *                              teste [0] = _MyObject.MyAbilityInfo.tes [t].AllAbilities [g];
         *                      }
         *              }
         *      }
         *
         *
         *
         *
         *
         *
         *      foundIt = false;
         *
         *      for (int i = 0; i < rngtries; i++) {
         *              test = (Quaternion.Euler (0, 0, Random.Range (1, rngtries + 1) * Random.Range (0, 90)) * (Vector3.right * TeleportDistance));//Deviding The Circle In 4, Then I Make Choose A RNG Side To Check
         *
         *              hitted = Physics2D.LinecastAll (objectChecking.Targeting.MyMovementTarget.transform.position + test, objectChecking.Targeting.MyMovementTarget.transform.position, WhatNotToHit);
         *              if (hitted.Length > 0) {
         *                      //		Debug.Log ("Hit Something " + hitted [hitted.Length - 1].point.x + " | " + hitted [hitted.Length - 1].point.y + " | " + test.normalized);
         *              } else {
         *                      foundIt = true;
         *                      //		Debug.Log ("No Wall Found");
         *                      test = objectChecking.Targeting.MyMovementTarget.transform.position + test;
         *                      i = rngtries;
         *              }
         *
         *      }
         *
         *      if (foundIt == false) {
         *              test = (Quaternion.Euler (0, 0, Random.Range (1, rngtries + 1) * Random.Range (0, 90)) * (Vector3.right * TeleportDistance));
         *              hitted = Physics2D.LinecastAll (objectChecking.Targeting.MyMovementTarget.transform.position + test, objectChecking.Targeting.MyMovementTarget.transform.position, WhatNotToHit);
         *              if (hitted.Length > 0) {
         *                      hitted = Physics2D.LinecastAll (objectChecking.Targeting.MyMovementTarget.transform.position, (Vector3)hitted [hitted.Length - 1].point, WhatNotToHit);
         *                      //	Debug.Log ( "Oposite Side Of Wall ");
         *                      test = (Vector3)(hitted [0].point) - (test.normalized * 0.05f);
         *
         *              } else {
         *                      //	Debug.Log ("No New Wall Found");
         *                      test = objectChecking.Targeting.MyMovementTarget.transform.position + test;
         *              }
         *      }
         *
         *      objectChecking.transform.position = test;
         *      transform.position = objectChecking.transform.position + Quaternion.Euler (0, parentRotaitons.y, parentRotaitons.z) * teste [0].SpawnPosition;//Setting The Start Location
         *
         *      _Direction.z = Vector3.Angle (Vector3.right, (objectChecking.Targeting.MyMovementTarget.transform.position - objectChecking.transform.position));
         *
         *      if ((objectChecking.Targeting.MyMovementTarget.transform.position - objectChecking.transform.position).y < 0) {
         *              _Direction.z = _Direction.z * -1.0f;
         *      }
         *      transform.rotation = Quaternion.Euler (_Direction);
         *
         *      gameObject.SetActive(true);
         *      Particleeffect.GetComponent<MoveForwardFast> ().starting = true;
         *
         *
         *      hitted = Physics2D.LinecastAll (transform.position, ((objectChecking.Targeting.MyMovementTarget.transform.position - objectChecking.transform.position).normalized * teste[0].SpellVariables[1]), WhatNotToHit);
         *
         *      hitted = Physics2D.BoxCastAll (transform.position, boxSize, _Direction.z,  ((Vector2)transform.position - hitted[0].point).normalized, 0, StopOnHit );
         *      Debug.Log ("HIT " + hitted.Length);*/

        //	Physics2D.BoxCastAll();

        //	_MyObject = GameObject.Find ("Otaku_Boss").GetComponent<EnemyManaging>();

        hitted = Physics2D.LinecastAll(transform.position, (Vector2)transform.position + (Vector2.right * 3), WhatNotToHit);
        hitted = Physics2D.BoxCastAll(transform.position, boxSize, 0, Vector2.right, 0, StopOnHit);
        //	hitted = Physics2D.BoxCastAll (transform.position, boxSize, 0,  ((Vector2)transform.position - hitted[0].point).normalized, 0, StopOnHit );

        ShootingVector        = objectChecking.GetWhatToTarget().TargetVector - transform.position;  //Vector from My Position To The Target
        transform.eulerAngles = (Quaternion.Euler(0, 0, transform.eulerAngles.z) * Vector2.right);
    }
 public void Awake()
 {
     ObjectWithBehaviour = GetComponent <CreatureRoot> ();
     MyCollisionInfo.CalculateNodePos(transform.position);
 }
示例#13
0
 public void Setup(CreatureRoot me)
 {
     myVariables  = me;
     AnimatorInfo = me.GetAnimatorVariables();
 }
    void FixedUpdate()
    {
        if (_StartMoving == true)
        {
            if (Dieing == false)
            {
                if (RemoveParent == false)
                {
                    RemoveParent        = true;
                    transform.parent    = null;
                    MyShootingDirection = MyShootingDirection.normalized;
                }

                transform.position += MyShootingDirection * test [0].SpellVariables [1] * Time.deltaTime;

                _ObjectHit = Physics2D.CircleCastAll(transform.position + (Vector3.right * 0.02f), test [0].SpellVariables [2], Vector2.zero, 1, WhatCanIHit);

                if (_ObjectHit.Length > 0)
                {
                    foreach (RaycastHit2D s in _ObjectHit)
                    {
                        if (s.transform.gameObject.layer == 8 || s.transform.gameObject.layer == 15)
                        {
                            targets = s.transform.GetComponent <CreatureRoot> ();
                            if (targets != null)
                            {
                                if (targets.Stats.HealthImmunity == false && targets.Stats.TotalImmunity == false)
                                {
                                    if (test [0].SpellVariables [0] * (1 - targets.Stats.PhysicalResistence) > 0)                                      //If The Creature Have Resist > 1 Then The Attack Will Heal The Creature. Fire On Fire Might Heal?
                                    {
                                        targets.TookDmg(Mathf.CeilToInt(test [0].SpellVariables [0] * (1 - targets.Stats.PhysicalResistence)));
                                    }
                                }
                            }
                        }
                    }

                    Dieing = true;
                    MyAnimator.SetInteger("SpellState", 1);
                }
            }
            else
            {
                transform.position += (MyShootingDirection * Time.deltaTime) / 2;
            }
        }
        else
        {
            MyShootingDirection = _MyObject.GetWhatToTarget().MyMovementTarget.transform.position - transform.position;

            if (MyShootingDirection.y < 0)
            {
                transform.rotation = Quaternion.Euler(0, 0, Vector3.Angle(Vector3.right, MyShootingDirection) * -1);
            }
            else
            {
                transform.rotation = Quaternion.Euler(0, 0, Vector3.Angle(Vector3.right, MyShootingDirection));
            }
            transform.localPosition = Quaternion.Euler(0, transform.parent.rotation.y, transform.parent.rotation.z) * test [0].SpawnPosition;
        }
    }
示例#15
0
 public virtual void SetMethod(CreatureRoot manager)
 {
 }
示例#16
0
    public void CompareStart(KeyValuePair <GameObject, KeyValuePair <Color, string[]> > InputString, CreatureRoot val)   //Is Called When The Player Types Something
    {
        myVariables = val.GetCreatureWordCheckInfo();

        if (!myVariables._Players.Contains(InputString))           //Adding New Players To The List
        {
            myVariables._Players.Add(InputString);
            PlayersTypedCorrect.Add(true);
        }

        for (int i = 0; i < myVariables._Players.Count; i++)          //Checking If The InputString/CurrentPlayer Is Corrent And Need Update
        {
            if (myVariables._Players [i].Key == InputString.Key)
            {
                _WordLengths = myVariables._Players [i].Value.Value [0].Length;

                if (_WordLengths > _ObjectHealth.Length)
                {
                    _WordLengths = _ObjectHealth.Length;
                }

                for (int j = (_WordLengths - 1); j >= 0; j--)
                {
                    if (myVariables._Players [i].Value.Value [0] [j] != _ObjectHealth [j])
                    {
                        PlayersTypedCorrect [i] = false;
                        break;
                    }
                    if (j == 0)
                    {
                        PlayersTypedCorrect [i] = true;
                        if (_WordLengths == _ObjectHealth.Length)
                        {
                            if (val.Stats.Health > 0)
                            {
                                val.Stats.Health--;



                                myVariables._Players [i].Key.GetComponent <PlayerManager> ().GotTheKill(_OriginalWord.Length);           //Giving The Player That Wrote The Last Word The Score  //TODO Give Each Player Tagged Score?
                                myVariables._Players [i].Key.GetComponent <PlayerManager> ().ResetWord();                                //Giving The Player That Wrote The Last Word The Score  //TODO Give Each Player Tagged Score?

                                _ObjectHealth = ListOfWords.GetRandomWords((int)val.Stats.WordDifficulty);
                                _OriginalWord = _ObjectHealth;

                                myVariables.TextElement.text = "";                                //Removing Text So That I Can Add It Again With New Colors
                                ColorValue = FreeCharacterColor.r.ToString("X2") + FreeCharacterColor.g.ToString("X2") + FreeCharacterColor.b.ToString("X2") + FreeCharacterColor.a.ToString("X2");

                                for (int k = 0; k < _ObjectHealth.Length; k++)
                                {
                                    myVariables.TextElement.text += string.Format("<color=#" + ColorValue + ">{0}</color>", _ObjectHealth [k]);
                                }

                                return;
                            }
                            else
                            {
                                myVariables._Players [i].Key.GetComponent <PlayerManager> ().ResetWord();                                //Giving The Player That Wrote The Last Word The Score  //TODO Give Each Player Tagged Score?
                                myVariables._Players [i].Key.GetComponent <PlayerManager> ().GotTheKill(_OriginalWord.Length);           //Giving The Player That Wrote The Last Word The Score  //TODO Give Each Player Tagged Score?

                                //TheCreature.OnDestroyed ();TODO Destroy/SendDestroy Request
                            }
                        }
                        break;
                    }
                }
                break;
            }
        }

        _WordLengths = 0;
        NullCheck    = 0;

        for (int i = 0; i < myVariables._Players.Count; i++)          //Iterating Through Once To Find The Two Players That Have Typed The Most. If Two Are The Same The The One That Tagged It Is The Leader
        {
            if (PlayersTypedCorrect [i] == true)
            {
                if (myVariables._Players [i].Value.Value [0].Length > _WordLengths)
                {
                    _2ndLongestPlayer = _LongestPlayer;
                    _LongestPlayer    = myVariables._Players [i];
                    NullCheck++;
                }
            }
        }

        _WordsToRemove = 0;
        myVariables.TextElement.text = "";                                                                                                            //Removing Text So That I Can Add It Again With New Colors

        if (NullCheck > 1)                                                                                                                            //Adding 2nd Place Player Color
        {
            _WordLengths = _2ndLongestPlayer.Value.Value [0].Length;                                                                                  //Length Of Player Word
            PlayerColor  = (Color32)_2ndLongestPlayer.Value.Key;                                                                                      //Player Color
            ColorValue   = PlayerColor.r.ToString("X2") + PlayerColor.g.ToString("X2") + PlayerColor.b.ToString("X2") + PlayerColor.a.ToString("X2"); //Setting Color, Only Way I Got It To Work

            for (int i = 0; i < _WordLengths; i++)                                                                                                    //Iterates Through And Adds The Letter Again But With Different Color
            {
                _WordsToRemove++;
                myVariables.TextElement.text += string.Format("<color=#" + ColorValue + ">{0}</color>", _ObjectHealth [i]);
            }
        }

        if (NullCheck > 0)                  //Adding 1nd Place Player Color
        {
            _WordLengths = _LongestPlayer.Value.Value [0].Length;
            PlayerColor  = (Color32)_LongestPlayer.Value.Key;
            ColorValue   = PlayerColor.r.ToString("X2") + PlayerColor.g.ToString("X2") + PlayerColor.b.ToString("X2") + PlayerColor.a.ToString("X2");

            for (int i = _WordsToRemove; i < _WordLengths; i++)
            {
                _WordsToRemove++;
                myVariables.TextElement.text += string.Format("<color=#" + ColorValue + ">{0}</color>", _ObjectHealth [i]);
            }
        }

        ColorValue = FreeCharacterColor.r.ToString("X2") + FreeCharacterColor.g.ToString("X2") + FreeCharacterColor.b.ToString("X2") + FreeCharacterColor.a.ToString("X2");

        for (int i = _WordsToRemove; i < _ObjectHealth.Length; i++)
        {
            myVariables.TextElement.text += string.Format("<color=#" + ColorValue + ">{0}</color>", _ObjectHealth [i]);
        }
    }
    void FixedUpdate()     //If I Hit Something I Do A Pushback On Everything Within (CircleRadius * 2.5f)
    {
        if (_MyObject == null)
        {
            Destroy(this.gameObject);
        }

        if (Collided == false)
        {
            if (_TimeToComplete > ClockTest.TheTimes)
            {
                _ObjectHit = Physics2D.CircleCastAll(transform.position, test [0].SpellVariables [1], Vector2.zero, 1, WhatCanIHit);                 //If Collided
                if (_ObjectHit.Length > 0)
                {
                    _ObjectHit = Physics2D.CircleCastAll(transform.position, test [0].SpellVariables [2], Vector2.zero, 1, WhatCanIHit);                     //If Collided Do A Expanded Pushback
                    foreach (RaycastHit2D s in _ObjectHit)
                    {
                        if (s.transform.gameObject.layer == 8 || s.transform.gameObject.layer == 15)
                        {
                            theObject = s.transform.GetComponent <CreatureRoot> ();
                            if (theObject != null)
                            {
                                if (theObject.Stats.TotalImmunity == false)
                                {
                                    if (theObject.Stats.HealthImmunity == false)
                                    {
                                        if (test [0].SpellVariables [0] * (1 - theObject.Stats.PhysicalResistence) > 0)                                          //If The Creature Have Resist > 1 Then The Attack Will Heal The Creature. Fire On Fire Might Heal?
                                        {
                                            theObject.TookDmg(Mathf.CeilToInt(test [0].SpellVariables [0] * (1 - theObject.Stats.PhysicalResistence)));
                                        }
                                    }

                                    if (theObject.Stats.VelocityImmunity == false)
                                    {
                                        vectorPower = (test [0].SpellVariables [5] * (1 - theObject.Stats.VelocityResist) - theObject.Stats.VelocityAbsorb); //Not Sertain About

                                        if (vectorPower > 0)                                                                                                 //If There Are More Resistance Then The Effect Does, Do Nothing
                                        {
                                            theObject.MyRigidBody.velocity = ((s.transform.position - transform.position).normalized * 1) * vectorPower;
                                            theObject.VelocityChange(vectorPower);
                                        }
                                    }
                                }
                            }
                        }
                    }

                    _MyObject.GetAnimatorVariables().SetAnimatorStage(1000);                     //1000 - 1010 Is Values Used For The Purpose Of Animator State Changes Which Isnt Similar To Any Spell 'ID'
                    _MyObject.Stats.Speed -= test [0].SpellVariables [5];
                    _TimeToComplete        = ClockTest.TheTimes + test [0].SpellVariables [6];
                    Collided = true;
                }
            }
            else
            {
                _MyObject.GetAnimatorVariables().SetAnimatorStage(0);
                _MyObject.Stats.Speed -= test [0].SpellVariables [5];
                Destroy(this.gameObject);
            }
        }
        else
        {
            if (_TimeToComplete <= ClockTest.TheTimes)
            {
                _MyObject.GetAnimatorVariables().SetAnimatorStage(0);                 //1000 - 1010 Is Values Used For The Purpose Of Animator State Changes Which Isnt Similar To Any Spell 'ID'
                Destroy(this.gameObject);
            }
        }
    }
    public override int RunCriteriaCheck(CreatureRoot objectChecking)                  //This Return True If All Criteria To Start Is Met. TODO Setup The New Collision System
    {
        if (objectChecking.GetAnimatorVariables().AnimatorStage == AnimatorStateCheck) //If The Animator Have Reached The Correct Point Then This Is False
        {
            return(0);
        }
        else
        {
            //Searching If There Is A Free Spot On A Rng Based Rotation.

            foundIt = false;

            for (int i = 0; i < rngtries; i++)                                                                                               //Going Through To Check If There Are Any Spots Around Target That Isnt busy/taken
            {
                test   = (Quaternion.Euler(0, 0, Random.Range(1, rngtries + 1) * Random.Range(0, 90)) * (Vector3.right * TeleportDistance)); //Deviding The Circle In 4, Then I Make Choose A RNG Side To Check
                hitted = Physics2D.LinecastAll(objectChecking.GetWhatToTarget().MyMovementTarget.transform.position + test, objectChecking.GetWhatToTarget().MyMovementTarget.transform.position, WhatNotToHit);

                if (hitted.Length == 0)                  //Didnt Hit Anything
                {
                    foundIt = true;
                    test    = objectChecking.GetWhatToTarget().MyMovementTarget.transform.position + test;
                    i       = rngtries;
                }
            }

            if (foundIt == false)              //If There Were No Free Location To Teleport To, Do 1 More And Then If Still False, Force Teleport As Close To The Target As Possible
            {
                test   = (Quaternion.Euler(0, 0, Random.Range(1, rngtries + 1) * Random.Range(0, 90)) * (Vector3.right * TeleportDistance));
                hitted = Physics2D.LinecastAll(objectChecking.GetWhatToTarget().MyMovementTarget.transform.position + test, objectChecking.GetWhatToTarget().MyMovementTarget.transform.position, WhatNotToHit);

                if (hitted.Length > 0)                  //Hit Something
                {
                    hitted = Physics2D.LinecastAll(objectChecking.GetWhatToTarget().MyMovementTarget.transform.position, (Vector3)hitted [hitted.Length - 1].point, WhatNotToHit);
                    test   = (Vector3)(hitted [0].point) - (test.normalized * 0.05f);
                }
                else                    //Didnt Hit Anything
                {
                    test = objectChecking.GetWhatToTarget().MyMovementTarget.transform.position + test;
                }
            }

            //Then A Check Needs To Be Made If The Ground Is Walkable Or Not, A Cliff Edge Or A Sea Of Magma ETC..
//TODO Commented Out This				if (objectChecking.GetNodeInfo ().MyAStar._WalkCost.ValidPositions (objectChecking.GetNodeInfo ().MyAStar._WalkCost.GetXPos(Mathf.RoundToInt( test.x / StressCommonlyUsedInfo.DistanceBetweenNodes)), objectChecking.GetNodeInfo ().MyAStar._WalkCost.GetYPos(Mathf.RoundToInt(test.y / StressCommonlyUsedInfo.DistanceBetweenNodes))) == false)
//TODO Commented Out This				return 0;


            //	if (objectChecking.GetNodeInfo ().MyAStar._WalkCost.ValidPositions (objectChecking.GetObjectNodeInfo ().MyCollisionInfo.XNode, objectChecking.GetObjectNodeInfo ().MyCollisionInfo.YNode) == false)
            //		return 0;

            //If A Spot Was Found,


            /*
             * //If Nothing Collides With The Object
             *
             * if (objectChecking.GetNodeInfo ().MyAStar._WalkCost.ValidPositions (objectChecking.GetObjectNodeInfo ().MyCollisionInfo.XNode, objectChecking.GetObjectNodeInfo ().MyCollisionInfo.YNode) == false)
             *      return 0;
             *
             * theX = objectChecking.GetNodeInfo ().MyAStar._WalkCost.GetXPos (objectChecking.GetObjectNodeInfo ().MyCollisionInfo.XNode);
             * theY = objectChecking.GetNodeInfo ().MyAStar._WalkCost.GetYPos (objectChecking.GetObjectNodeInfo ().MyCollisionInfo.YNode);
             *
             * if (objectChecking.GetNodeInfo ().MyAStar._WalkCost.BaseGroundLayer [theX, theY] == 1) {//If ID == Wall, Return 'False'.
             *      return 0;
             * }
             *
             * iterations = objectChecking.GetNodeInfo ().MyAStar._WalkCost.CollisionAmount [theX, theY];
             *
             * for (int i = 0; i < iterations; i++) {//Iterating Through The Taken Collision IDs
             *      if (objectChecking.GetNodeInfo ().MyAStar._WalkCost.CollisionMap [theX, theY, i].NodesCollisionID == 1) {//If ID == Wall, Return 'False'.
             *              return 0;
             *      }
             * }
             *
             * if (objectChecking.GetAnimatorVariables ().AnimatorStage != 0)
             *      return 0;
             */
        }

        return(3);       //If Nothing Failed, Return 'True'.
    }
 public void SetAttackTarget(Transform target)
 {
     _Target      = target;
     _TargetStats = _Target.GetComponent <CreatureRoot>();
 }
示例#20
0
 public virtual int RunCriteriaCheck(CreatureRoot objectChecking)
 {
     return(0);
 }