private void Set(SetLocation msg)
 {
     if (msg.ReceiverId == Entity.MyEntityId)
     {
         Target.position = CoordConverter.GeocToLocal(new CppStructs.XYZ(msg.X, msg.Y, msg.Z));
     }
 }
示例#2
0
 protected virtual void SetLocationHandler(SetLocation msg)
 {
     if (msg.ReceiverId == Entity.MyEntityId)
     {
         if (OnSetPosition != null)
         {
             OnSetPosition(CoordConverter.GeocToLocal(new CppStructs.XYZ(msg.X, msg.Y, msg.Z)));
         }
     }
 }
    private void BuildingDamageHandler(BuildingDamageResult bdr)
    {
        switch (bdr.Result)
        {
        case BuildingDamageResult.DamageResult.None:
            break;

        case BuildingDamageResult.DamageResult.PartiallyDestroyed:
            break;

        case BuildingDamageResult.DamageResult.Destroyed:
            Vector3 local = CoordConverter.GeocToLocal(bdr.Location);
            StartCoroutine(DestroyBuildingAtPosition(local));
            break;

        default:
            break;
        }
    }
示例#4
0
    virtual protected void SetLocationCallback(SetLocation sl)
    {
        if (sl.EntityId.Equals(PublishedEntity.MyEntityId))
        {
            Vector3 geocLoc  = new Vector3((float)sl.X, (float)sl.Y, (float)sl.Z);
            Vector3 localLoc = CoordConverter.GeocToLocal(geocLoc);
            //localLoc.y += 10;

            transform.position = localLoc;
            if (GetComponent <Rigidbody>())
            {
                GetComponent <Rigidbody>().velocity = Vector3.zero;
            }

            if (GetComponent <InfantryFirstPersonController>())
            {
                GetComponent <InfantryFirstPersonController>().StopMoving();
            }
        }
    }
    private IEnumerator DamagedBuildingsReportHandler(DamagedBuildingsReport dbr)
    {
        if (initialized)
        {
            yield break;
        }

        while (CopiesParent == null || !terrainFullyLoaded)
        {
            yield return(null);
        }

        DamagedBuildingsReport.DamagedBuildings[] buildings = dbr.Buildings;

        for (int i = 0; i < buildings.Length; i++)
        {
            switch (buildings[i].State)
            {
            case DamagedBuildingsReport.DamageState.None:
                break;

            case DamagedBuildingsReport.DamageState.PartiallyDestroyed:
                break;

            case DamagedBuildingsReport.DamageState.Destroyed:
                Vector3 local = CoordConverter.GeocToLocal(buildings[i].Location);
                StartCoroutine(DestroyBuildingAtPosition(local));
                break;

            default:
                break;
            }
        }

        initialized = true;
    }