Exemplo n.º 1
0
 void OnTriggerExit(Collider collisionInfo)
 {
     if (isSideTheWall)
     {
         if (collisionInfo.gameObject.tag == "wall")
         {
             GameObject  main      = GameObject.Find("MainScript");
             InGameLogic gameLogic = main.GetComponent <InGameLogic>();
             gameLogic.UserOutSideTheBoard();
         }
     }
 }
Exemplo n.º 2
0
    void OnTriggerExit(Collider collisionInfo)
    {
        if (isSideTheWall)
        {
            if (collisionInfo.gameObject.tag == "wall")
            {
                GameObject  main      = GameObject.Find("MainScript");
                InGameLogic gameLogic = main.GetComponent <InGameLogic>();
                gameLogic.NPCDestoried();

                //do Destory myself
                Destroy(gameObject);
            }
        }
    }
Exemplo n.º 3
0
    // Collision handling
    void OnCollisionStay(Collision collisionInfo)
    {
        if (!isPlayerRegistered)
        {
            if (collisionInfo.gameObject.tag == "board")
            {
                GameObject  main      = GameObject.Find("MainScript");
                InGameLogic gameLogic = main.GetComponent <InGameLogic>();
                gameLogic.isUserRegistered();

                //off the
                isPlayerRegistered = true;
            }
        }
        else
        {
            if (collisionInfo.gameObject.tag == "wall")
            {
                if (moveSpeed > 0)
                {
                    bool isFaceToTarget = false;
                    int  layerMask      = 1 << 8;
                    layerMask = ~layerMask;
                    RaycastHit hit;
                    // Does the ray intersect any objects excluding the player layer
                    if (Physics.Raycast(transform.position, transform.TransformDirection(Vector3.forward), out hit, Mathf.Infinity, layerMask))
                    {
                        Debug.DrawRay(transform.position, transform.TransformDirection(Vector3.forward) * hit.distance, Color.yellow);
                        Debug.Log("Did Hit");
                        isFaceToTarget = true;
                    }

                    Debug.Log("on hit wall");
                    if (isFaceToTarget)
                    {
                        moveSpeed = 0;
                        //					if(onHit_speedRecoverDelay <= 0)
                        //					{
                        //						onHit_speedRecoverDelay = 1;
                        //					}
                    }
                }
            }

            if (collisionInfo.gameObject.tag == "Unit")
            {
                if (powerBar.CurrentSpeed() >= 50F)
                {
                    //Do weapon show
                    foreach (WeaponController wc in weaponHolder)
                    {
                        wc.isLoop = false;
                        wc.Action_attack_rotate((360F * 5), 1.3F);
                    }

                    moveBack(collisionInfo);

//					//stop the movement
//					moveSpeed = 0F;
                }
            }
        }
    }