public void OnSyncedTriggerExit(TSCollision other)
 {
     if (ShowLog)
     {
         Debug.LogErrorFormat("YeGuaiAI====>Trigger  Exit==>{0}", other.gameObject.name);
     }
 }
Beispiel #2
0
 /**
  * @brief Tints box's material with gray color when it collides with the ball.
  **/
 public void OnSyncedCollisionEnter(TSCollision other)
 {
     if (other.gameObject.name == "Box(Clone)")
     {
         other.gameObject.GetComponent <Renderer> ().material.color = Color.gray;
     }
 }
 public void OnSyncedCollisionStay(TSCollision other)
 {
     if (ShowLog)
     {
         Debug.LogErrorFormat("YeGuaiAI====>Collision   Stay==>{0}", other.gameObject.name);
     }
 }
Beispiel #4
0
 /**
  * @brief Increases box's local scale by 1% while collision with a ball remains active.
  **/
 public void OnSyncedCollisionStay(TSCollision other)
 {
     if (other.gameObject.name == "Box(Clone)")
     {
         other.gameObject.transform.localScale *= 1.01f;
     }
 }
Beispiel #5
0
    // Detect an enemy
    public void OnSyncedTriggerEnter(TSCollision other)
    {
        if (unitState != UnitState.Walking)
        {
            return;
        }


        Debug.Log("Unit: Collision Trigger Entered between " + gameObject.name + ":" + gameObject.GetInstanceID() + " and " + other.collider.name + ":" + other.collider.GetInstanceID());
        GameObject collided = other.collider.gameObject;


        // Check ownership of the collided
        if (collided.tag == "Unit")
        {
            if (collided.GetComponent <UnitBehavior>().owner.Id != owner.Id)
            {
                Debug.Log("Unit: New Target Aquired");
                target    = collided;
                unitState = UnitState.Attacking;
            }
        }
        else if (collided.tag == "Base")
        {
            if (collided.GetComponent <BoxBehaviour>().owner.Id != owner.Id)
            {
                Debug.Log("Unit: New Base Target Aquired");
                target    = collided;
                unitState = UnitState.Attacking;
            }
        }
    }
    public void OnSyncedTriggerEnter(TSCollision other)
    {
        int otherLayerMask = (int)Math.Pow(2, other.gameObject.layer);

        Debug.LogErrorFormat("houyiBullet====>Trigger  Enter==>{0},{1},{2}", otherLayerMask, other.gameObject.name, LayerMask.GetMask("Role"));
        if (otherLayerMask == LayerMask.GetMask("Role"))
        {
            Actor mActor = other.gameObject.GetComponent <Actor>();
            Debug.LogErrorFormat("houyiBullet====>TriggerEnter==>自己阵营:{0},对方阵营={1}", OwnerCamp, mActor.OwnerCamp);
            if (OwnerCamp != mActor.OwnerCamp)
            {
                mActor.mActorAttr.Hp -= 10;
                TrueSyncManager.SyncedDestroy(gameObject);
            }
        }
        else if (otherLayerMask == LayerMask.GetMask("Monsters"))
        {
            YeGuaiAI mYeGuaiAI = other.gameObject.GetComponent <YeGuaiAI>();
            mYeGuaiAI.AddHp(-10, OwnerID);
        }
        else if (otherLayerMask == LayerMask.GetMask("GroundWall"))
        {
            TrueSyncManager.SyncedDestroy(gameObject);
        }
    }
 public void OnSyncedCollisionExit(TSCollision other)
 {
     other.gameObject.GetComponent <Renderer>().material.color = Color.blue;
     if (ShowLog)
     {
         Debug.LogErrorFormat("YeGuaiAI====>Collision   Exit==>{0}", other.gameObject.name);
     }
 }
Beispiel #8
0
 /**
  * @brief Increases box's local scale by 1% while collision with a ball remains active.
  **/
 public void OnSyncedCollisionStay(TSCollision other)
 {
     if (other.gameObject.name == "Box(Clone)")
     {
         Debug.Log("OnSyncedCollisionStay:other:" + other.transform.name);
         other.gameObject.transform.localScale *= 1.01f;
     }
 }
Beispiel #9
0
 /**
  * @brief Resets changes in box's properties when there is no more collision with the ball.
  **/
 public void OnSyncedCollisionExit(TSCollision other)
 {
     if (other.gameObject.name == "Box(Clone)")
     {
         other.gameObject.transform.localScale = Vector3.one;
         other.gameObject.GetComponent <Renderer> ().material.color = Color.blue;
     }
 }
Beispiel #10
0
 public void OnSyncedTriggerEnter(TSCollision other)
 {
     if (other.gameObject.tag != "Coin")
     {
         return;
     }
     TrueSyncManager.SyncedDestroy(other.gameObject);
 }
Beispiel #11
0
 /**
  * @brief Tints box's material with gray color when it collides with the ball.
  **/
 public void OnSyncedCollisionEnter(TSCollision other)
 {
     if (other.gameObject.name == "Box(Clone)")
     {
         Debug.Log("OnSyncedCollisionEnter:other:" + other.transform.name);
         other.gameObject.GetComponent <Renderer>().material.color = Color.gray;
     }
 }
Beispiel #12
0
 public void OnSyncedTriggerExit(TSCollision other)
 {
     Debug.LogErrorFormat("Actor====>Trigger  Exit==>{0}", other.gameObject.name);
     if (other.gameObject.name == "BaseWall")
     {
         _TriggerStayTSCollisions.Remove(other.gameObject.GetInstanceID());
     }
 }
Beispiel #13
0
 public void OnSyncedCollisionEnter(TSCollision other)
 {
     if (!isScene3)
     {
         return;
     }
     Debug.Log(other.gameObject.name + "+碰撞");
     message = other.gameObject.name + "+碰撞";
 }
    public void OnSyncedTriggerEnter(TSCollision other)
    {
        SyncedHealth health = other.gameObject.GetComponent <SyncedHealth>();

        if (health != null)
        {
            health.TakeDamage(Damage);
        }
    }
Beispiel #15
0
 public void OnSyncedTriggerEnter(TSCollision other)
 {
     Debug.LogErrorFormat("Actor====>Trigger  Enter==>{0}", other.gameObject.name);
     if (other.gameObject.name == "BaseWall")
     {
         //_TriggerStayTSCollision = other;
         _TriggerStayTSCollisions[other.gameObject.GetInstanceID()] = other;
     }
 }
Beispiel #16
0
 public void OnSyncedTriggerEnter(TSCollision other)
 {
     if (other.gameObject.tag != "Coin")
     {
         return;
     }
     foreach (var player in GameObject.FindGameObjectsWithTag("Player"))
     {
         player.GetComponent <CoinSpawner>().Coin++;
     }
     TrueSyncManager.SyncedDestroy(other.gameObject);
 }
Beispiel #17
0
 public void OnSyncedTriggerEnter(TSCollision other)
 {
     if (other.gameObject.tag == "Player")
     {
         PlayerMovement hitPlayer = other.gameObject.GetComponent <PlayerMovement>();
         if (hitPlayer.owner != owner)
         {
             TrueSyncManager.SyncedDestroy(this.gameObject);
             hitPlayer.Respawn();
         }
     }
 }
Beispiel #18
0
 public void OnSyncedCollisionEnter(TSCollision other)
 {
     if (other.gameObject.CompareTag("Bullet"))
     {
         //Debug.Log ("COLLIDING: " + other.gameObject.name);
         ChangeLife(false, other.gameObject.GetComponent <Bullet> ().Damage);
         TrueSyncManager.SyncedDestroy(other.gameObject);
     }
     if (other.gameObject.CompareTag("BadGuy") && this.gameObject.CompareTag("Player"))
     {
         //Debug.Log ("COLLIDING: " + other.gameObject.name);
         ChangeLife(false, 5);
     }
 }
Beispiel #19
0
    public void OnSyncedTriggerEnter(TSCollision other)
    {
        Debug.Log("Base: Collision Trigger Entered between " + gameObject.name + ":" + gameObject.GetInstanceID() + " and " + other.collider.name + ":" + other.collider.GetInstanceID());
        GameObject collided = other.collider.gameObject;

        // Check ownership of the collided
        if (collided.tag == "Unit")
        {
            if (collided.GetComponent <UnitBehavior>().owner.Id != owner.Id)
            {
                Debug.Log("Base: New Target Aquired (" + collided.GetComponent <UnitBehavior>().owner.Id + owner.Id + ")");
                target = collided;
            }
        }
    }
Beispiel #20
0
 public void OnSyncedTriggerStay(TSCollision other)
 {
     //Debug.LogErrorFormat("Actor====>Trigger  Stay==>{0}", other.gameObject.name);
     if (other.gameObject.name == "BaseWall")
     {
         //Debug.LogFormat("接触点法线向量:{0},穿透{1}", other.contacts[0].normal.ToString(), other.contacts[0].Penetration);
         //Debug.LogFormat("两个物体间的接触点{0},{1},接触点法线向量{2}", other.contacts[0].point.ToString(), other.contacts[0].point2.ToString(), other.contacts[0].normal.ToString());
         //Debug.LogFormat("Actor====>PositionBack=1=>{0}", AllTSTransform.position.ToString());
         //Debug.LogFormat("Actor====>PositionBack=2=>{0},{1}", other.transform.position.ToString(), AllTSTransform.transform.position.ToString());
         //Debug.LogFormat("Actor====>PositionBack=3=>{0},{1}", other.collider.Shape.BoundingBox.ToString(), tsCollider.Shape.BoundingBox.ToString());
         //Debug.LogFormat("Actor====>PositionBack=4=>{0},{1}", other.collider.bounds.ToString(), tsCollider.bounds.ToString());
         //_TriggerStayTSCollision = other;
         _TriggerStayTSCollisions[other.gameObject.GetInstanceID()] = other;
         //AllTSTransform.PositionBack(other);
     }
 }
Beispiel #21
0
        public void OnSyncedCollisionEnter(TSCollision other)
        {
            BaseObject baseObj = other.gameObject.GetComponent <BaseObject>();

            if (baseObj)
            {
                if (baseObj.type == ObjectType.ITEM)
                {
                    //调用吃道具效果
                }
                else if (baseObj.type == ObjectType.ENV)
                {
                    //调用触碰环境效果
                }
            }
            else
            {
                //LogUtil.Debug(gameObject.name + " collide with " + other.gameObject.name + "(no BaseObject.type)");
            }
        }
Beispiel #22
0
 public void OnSyncedCollisionEnter(TSCollision other)
 {
     if (other.gameObject.tag == "Food")
     {
         // grow slow and destroy food
         currentScale *= growSlow;
         // move food to a new place (deterministic randoms)
         TSRigidBody food = other.rigidbody;
         food.position = new TSVector(TSRandom.Range(-35, 35), 0, TSRandom.Range(-20, 20));
     }
     else if (other.gameObject.tag == "Player")
     {
         LockPlayer enemy = other.gameObject.GetComponent <LockPlayer> ();
         if (ss.Radius > enemy.ss.Radius)
         {
             // grow fast and eat other
             currentScale *= growFast;
             enemy.tsRigidBody.position = new TSVector(TSRandom.Range(-35, 35), 0, TSRandom.Range(-20, 20));
             enemy.currentScale         = FP.One;
             //TrueSyncManager.SyncedDestroy(other);
         }
     }
 }
Beispiel #23
0
    public void OnSyncedTriggerStay(TSCollision other)
    {
        if (SelfTick % 10 != 0)
        {
            return;
        }
        int otherLayerMask = (int)Math.Pow(2, other.gameObject.layer);

        //Debug.LogErrorFormat("houyiDarkArea====>Trigger  Stay==>{0},{1}", otherLayerMask, other.gameObject.name);
        if (otherLayerMask == LayerMask.GetMask("Role"))
        {
            Actor mActor = other.gameObject.GetComponent <Actor>();
            //Debug.LogErrorFormat("houyiDarkArea====>TriggerEnter==>自己阵营:{0},对方阵营={1}", OwnerCamp, mActor.OwnerCamp);
            if (OwnerCamp != mActor.OwnerCamp)
            {
                mActor.mActorAttr.Hp -= 5;
            }
        }
        else if (otherLayerMask == LayerMask.GetMask("Monsters"))
        {
            YeGuaiAI mYeGuaiAI = other.gameObject.GetComponent <YeGuaiAI>();
            mYeGuaiAI.AddHp(-5, OwnerID);
        }
    }
Beispiel #24
0
 /**
  * @brief Increases box's local scale by 1% while collision with a ball remains active.
  **/
 public void OnSyncedCollisionStay(TSCollision other)
 {
     //Debug.LogErrorFormat("Actor====>Collision   Stay==>{0}", other.gameObject.name);
 }
Beispiel #25
0
 public void OnSyncedTriggerEnter(TSCollision collision)
 {
     moveDir = collision.contacts[0].normal;
 }
Beispiel #26
0
 /**
  * @brief Resets changes in box's properties when there is no more collision with the ball.
  **/
 public void OnSyncedCollisionExit(TSCollision other)
 {
     //other.gameObject.GetComponent<Renderer>().material.color = Color.blue;
     Debug.LogErrorFormat("Actor====>Collision   Exit==>{0}", other.gameObject.name);
 }
Beispiel #27
0
 public void OnSyncedCollisionEnter(TSCollision collision)
 {
     Debug.Log("");
 }
Beispiel #28
0
 public void OnSyncedCollisionEnter(TSCollision other)
 {
 }
Beispiel #29
0
 public void OnSyncedTriggerExit(TSCollision other)
 {
     TrueSyncManager.Destroy(other.gameObject);
 }
Beispiel #30
0
 public void OnSyncedTriggerExit(TSCollision other)
 {
     //Debug.LogErrorFormat("houyiDarkArea====>Trigger  Exit==>{0}", other.gameObject.name);
 }