Exemplo n.º 1
0
    public override void ApplyTileEffect(TestWalkScript target)      //Called From The Tile. 'What Does The Spell Do' -> 'Im Applying A Buff' -> 'Apply Buff'
    {
        _TravelDirection = target.transform.position - target.PreviousPosition;

        nodePosX = Mathf.FloorToInt((target.transform.position.x - StressCommonlyUsedInfo.LowestXPos) / 0.25f);        //World Position Translated To Node Position
        nodePosY = Mathf.FloorToInt((target.transform.position.y - StressCommonlyUsedInfo.LowestYPos) / 0.25f);        //World Position Translated To Node Position

        /*TODO I Believe This Can Be Done In One Single Line. Maths Hard*/
        if (target.PreviousPosition.x - StressCommonlyUsedInfo.LowestXPos < nodePosX * 0.25f)                                                                                                                                         //If The Previous Position Were On The Left Side Of The Nodes Left Side
        {
            target.transform.position = target.PreviousPosition + (((((nodePosX * 0.25f) + StressCommonlyUsedInfo.LowestXPos) - target.PreviousPosition.x) / _TravelDirection.x) * _TravelDirection) + (Vector3.left * OffsetX);      //Finding How Long To Travel Until It Hitting The Wall On The Left Side. Then Multiplying With TravelVector. Bing Boom BAaimm. Position Of Collision
        }
        else if (target.PreviousPosition.x - StressCommonlyUsedInfo.LowestXPos > (1 + nodePosX) * 0.25f)                                                                                                                              //If The Previous Position Were On The Right Side Of The Node
        {
            target.transform.position = target.PreviousPosition + (((((1 + nodePosX) * 0.25f) + StressCommonlyUsedInfo.LowestXPos) - target.PreviousPosition.x) / _TravelDirection.x) * _TravelDirection + (Vector3.right * OffsetX); //Offset Is Simply To Force The Object To Exit The Wall It Entered Which Were Blocked
        }
        else if (target.PreviousPosition.y - StressCommonlyUsedInfo.LowestYPos > (1 + nodePosY) * 0.25f)                                                                                                                              //If The Previous Position Were Over The Node
        {
            target.transform.position = target.PreviousPosition + (((((1 + nodePosY) * 0.25f) + StressCommonlyUsedInfo.LowestYPos) - target.PreviousPosition.y) / _TravelDirection.y) * _TravelDirection + (Vector3.up * OffsetX);
        }
        else if (target.PreviousPosition.y - StressCommonlyUsedInfo.LowestYPos < nodePosY * 0.25f)            //If The Previous Position Were Below The Node
        {
            target.transform.position = target.PreviousPosition + (((((nodePosY) * 0.25f) + StressCommonlyUsedInfo.LowestYPos) - target.PreviousPosition.y) / _TravelDirection.y) * _TravelDirection + (Vector3.down * OffsetX);
        }
    }
    public override void ApplyTileEffect(TestWalkScript target)      //Called From The Tile. 'What Does The Spell Do' -> 'Im Applying A Buff' -> 'Apply Buff'
    {
        _ForceApplyer.x = ((target.transform.position.x - StressCommonlyUsedInfo.LowestXPos) % 0.25f) - 0.125f;
        _ForceApplyer.y = ((target.transform.position.y - StressCommonlyUsedInfo.LowestYPos) % 0.25f) - 0.125f;

        target.FocePush();
        target.MyBody2D.velocity = _ForceApplyer.normalized / _BounceStrength;
    }
Exemplo n.º 3
0
    public void OnExit(TestWalkScript exitingObject)      //What To Do When Exiting
    {
        if (RemoveOnExit == true)
        {
            if (TheSpell != null)
            {
                TheSpell.RemoveTileEffect(exitingObject);
            }
            else
            {
//				Debug.Log("Spell Missing");
            }
        }
    }
Exemplo n.º 4
0
    public void OnEnter(TestWalkScript enteringObject)      //What Entering A Tile, The Tile Can Have Effects On It, Like Lava -> Burning Spell.    Quicksand -> Slowing Spell.    ......
    {
        if (ApplyOnEnter == true)
        {
            if (TheSpell != null)
            {
                TheSpell.ApplyTileEffect(enteringObject);
            }
            else
            {
//				Debug.Log("Spell Missing");
            }
        }
    }
Exemplo n.º 5
0
 public virtual void ApplyTileEffect(TestWalkScript target)      //Called From The Tile. 'What Does The Spell Do' -> 'Im Applying A Buff' -> 'Apply Buff'
 {
 }
Exemplo n.º 6
0
 public virtual void ApplySpellEffect(TestWalkScript target)
 {
 }