示例#1
0
    void FixedUpdate()
    {
        //	if (_MyObject == null)//When Shooting Object Dies, Destroy This Object
        //		Destroy (this.gameObject);

        if (TargetClose == false)
        {
            if (Vector3.Distance(transform.position, _MyObject.GetWhatToTarget().MyMovementTarget.transform.position) < test [0].SpellVariables [4])
            {
                TargetClose = true;
                _MyObject.GetAnimatorVariables().SetAnimatorStage(2);
                _MyObject.Stats.Speed += test [0].SpellVariables [1];
                timeLeft = ClockTest.TheTimes + (test [0].SpellVariables [2]);
            }
            else
            {
                if (timeLeft < ClockTest.TheTimes)                           //Time To Scout
                {
                    _MyObject.GetAnimatorVariables().SetAnimatorStage(1000); //1000 - 1010 Is Values Used For The Purpose Of Animator State Changes Which Isnt Similar To Any Spell 'ID'
                    _MyObject.GetAbilityInfo().AddLostTime(bulletID);
                    _MyObject.GetAnimatorVariables().AbilityRunning = false;
                    Destroy(this.gameObject);
                }
            }
        }
        else
        {
            if (attackTime < ClockTest.TheTimes)
            {
                attackTime = ClockTest.TheTimes + (test [0].SpellVariables [3]);
                Instantiate(MoulySpikes, transform.position, Quaternion.identity).SetMethod(_MyObject);
            }

            if (timeLeft < ClockTest.TheTimes)                           //Time To Scout
            {
                _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 [1];

                _MyObject.GetAbilityInfo().AddLostTime(bulletID);
                _MyObject.GetAnimatorVariables().AbilityRunning = false;
                Destroy(this.gameObject);
            }
        }
    }
示例#2
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);
     }
 }
示例#4
0
    public void AbilityChecker()       //Checking If An Ability Can Be Used.
    {
        for (int i = 0; i < _AbilityArrayLength; i++)
        {
            if (TransitionAbilities [myVariables.GetAnimatorVariables().SpellTransition].AllAbilities [i].SpellCurrentCD < ClockTest.TheTimes)              //If The Spell Dont Have A CD.

            {
                AbilityCheck = TransitionAbilities [myVariables.GetAnimatorVariables().SpellTransition].AllAbilities [i].SpellInfo.RunCriteriaCheck(myVariables);

                if (AbilityCheck > 0)                                                                                                              //If True The An Ability Starts To Run
                {
                    TransitionAbilities [myVariables.GetAnimatorVariables().SpellTransition].AllAbilities [i].SpellCurrentCD = ClockTest.TheTimes; //Setting Inisiated Time
                    tes.Add(TransitionAbilities [myVariables.GetAnimatorVariables().SpellTransition]);
                    myVariables.GetAnimatorVariables().SetAnimatorStage(AbilityCheck);
                    myVariables.GetAnimatorVariables().AbilityRunning = true;
                    //	OldTime = ClockTest.TheTimes;
                    break;
                }
            }
        }
    }
示例#5
0
 public void Setup(CreatureRoot me)
 {
     myVariables  = me;
     AnimatorInfo = me.GetAnimatorVariables();
 }
    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'.
    }
    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);
            }
        }
    }