// Update is called once per frame
    void Update()
    {
        if (Active_UIElements._obj.GetActiveElementParent() != null && Active_UIElements._obj.GetActiveUIElement() != null)
        {
            if (Input.GetMouseButtonDown(0))
            {
                var rayCast = new RayCasts();
                if (Active_UIElements._obj.GetModelObj())
                {
                    if (!rayCast.GraphicRaycast("UIElment_Dynamic_ModelObj(Clone)", GetComponent <EventSystem>()))
                    {
                        DestroyUIElement("UIElment_Dynamic_ModelObj(Clone)");
                    }
                }

                if (Active_UIElements._obj.GetInteriorObj())
                {
                    if (!rayCast.GraphicRaycast("UIElment_Dynamic_InteriorObj(Clone)", GetComponent <EventSystem>()))
                    {
                        DestroyUIElement("UIElment_Dynamic_InteriorObj(Clone)");
                    }
                }
            }
        }
    }
Exemple #2
0
 // Update is called once per frame
 void Update()
 {
     if (RayCasts.IsGroundTileBelowBy(transform, 0.025f))
     {
         Destroy(gameObject);
     }
     cLifetime += Time.deltaTime;
 }
 public virtual void Update()
 {
     if (IsMidJump && IsDecending())
     {
         IsMidJump = false;
     }
     if (RayCasts.IsGroundTileBelowBy(transform, GroundCheckDistance) && !IsMidJump)
     {
         if (JumpDirection.x >= 0)
         {
             GroundClaimsService.GetInstance().LeftTeamClaimUpdate(transform.localPosition.x);
         }
         else
         {
             GroundClaimsService.GetInstance().RightTeamClaimUpdate(transform.localPosition.x);
         }
         if (AllowMovement)
         {
             Jump();
         }
     }
     //put the breaks on if moving too fast
     if (Mathf.Abs(Body.velocity.x) > JumpForce.x)
     {
         if (JumpDirection.normalized.x > 0)
         {
             if (Body.velocity.x > 0)
             {
                 //slow down
                 Body.AddForce(-JumpDirection.normalized * JumpForce.x);
             }
             else
             {
                 //speed up
                 Body.AddForce(JumpDirection.normalized * JumpForce.x);
             }
         }
         else
         {
             if (Body.velocity.x < 0)
             {
                 //slow down
                 Body.AddForce(-JumpDirection.normalized * JumpForce.x);
             }
             else
             {
                 //speed up
                 Body.AddForce(JumpDirection.normalized * JumpForce.x);
             }
         }
     }
 }
 // Update is called once per frame
 void Update()
 {
     if (Interface._obj.GetPanelActive())
     {
         if (Input.GetMouseButtonDown(0))
         {
             var rayCast = new RayCasts();
             if (!rayCast.GraphicRaycast(Interface._obj.GetActivePanelName(), GetComponent <EventSystem>()))
             {
                 DisablePanel(Interface._obj.GetActivePanelName());
             }
         }
     }
 }
Exemple #5
0
 public void Update()
 {
     if (!StuckInGround)
     {
         Vector3 normVelocity = Body.velocity.normalized;
         //Calculate renderable rotation
         Renderable.right = transform.position - (transform.position + normVelocity);
         if (RayCasts.IsGroundTileBelowBy(transform, 0.05f))
         {
             StuckInGround      = true;
             transform.position = transform.position + (Vector3)Body.velocity * Time.deltaTime;
             StartCoroutine(StayStillThenDestroy());
         }
     }
 }
Exemple #6
0
    // Update is called once per frame
    void Update()
    {
        if (Interface._obj.GetObjInfoPanelState())
        {
            if (Input.GetMouseButtonDown(0))
            {
                RayCasts rayCasts = new RayCasts();

                if (!rayCasts.GraphicRaycast("Object_Info", GetComponent <EventSystem>()))
                {
                    Interface._obj.GetClassRefrence_UPV().GetObjectInfo().SetActive(false);
                    Interface._obj.SetObjInfoPanelState(false);
                }
            }
        }
    }
 void Update()
 {
     if (RayCasts.IsGroundTileBelowBy(transform, 0.1f))
     {
         int roll = Dice.Roll(20, 25);
         for (int x = 0; x < roll; x++)
         {
             float            xForce   = Dice.Roll(-1f, 1f);
             float            yForce   = Dice.Roll(0.5f, 1f);
             FireballShrapnel shrapnel = Instantiate(FireballShrapnelPrefab);
             shrapnel.gameObject.layer   = gameObject.layer;
             shrapnel.transform.position = transform.position;
             shrapnel.Body.AddForce(new Vector2(xForce, yForce), ForceMode2D.Impulse);
             shrapnel.transform.SetParent(transform.parent);
         }
         Destroy(gameObject);
     }
 }