コード例 #1
0
ファイル: GuardedCrate.cs プロジェクト: bazz3l/GuardedCrate
            private void SpawnPlane()
            {
                _plane = GameManager.server.CreateEntity(PLANE_PREFAB) as CargoPlane;
                if (_plane == null)
                {
                    return;
                }

                _plane.Spawn();
                _plane.gameObject.GetOrAddComponent <CargoComponent>().SetEvent(this);
            }
コード例 #2
0
        private void CallStrike(Vector3 position)
        {
            CargoPlane entity = CreatePlane();

            entity.Spawn();

            StrikePlane plane = entity.gameObject.AddComponent <StrikePlane>();

            plane.InitializeFlightPath(position);

            if (configData.Other.Broadcast)
            {
                PrintToChat(msg("strikeInbound"));
            }
        }
コード例 #3
0
 public void SpawnPlane(CargoPlane plane, Vector3 position, float speed, bool isSquad = false, Vector3 offset = new Vector3())
 {
     enabled        = true;
     Plane          = plane;
     TargetPosition = position;
     Plane.InitDropPosition(position);
     Plane.Spawn();
     if (isSquad)
     {
         Vector3 SpawnPos = CalculateSpawnPos(offset);
         StartPos.SetValue(Plane, SpawnPos);
         EndPos.SetValue(Plane, SpawnPos - new Vector3(0, 0, TerrainMeta.Size.x));
         Plane.transform.position = SpawnPos;
         Plane.transform.rotation = new Quaternion(0, 180, 0, 0);
     }
     TimeToTake.SetValue(Plane, Vector3.Distance((Vector3)StartPos.GetValue(Plane), (Vector3)EndPos.GetValue(Plane)) / speed);
     InvokeRepeating("CheckDistance", 3, 3);
 }
コード例 #4
0
            /// <summary>
            /// Calls custom cargo plane into action
            /// </summary>
            /// <param name="targetPosition">Position to drop item to</param>
            public CargoPlane CallPlane(Vector3 targetPosition)
            {
                // Create cargo
                CargoPlane cargoPlane = CreatePlane();

                cargoPlane.Spawn();
                cargoPlane.name  = "Bang Bang Cargo Plane";
                cargoPlane._name = "Bang Bang Cargo Plane";

                // If we don't specify the target position, then a random position is used
                if (targetPosition == null)
                {
                    targetPosition = cargoPlane.RandomDropPosition();
                }

                // Create custom cargo plane, init and set custom airdrop on position reached
                _airbornePlane = cargoPlane.gameObject.AddComponent <SpecialAirdropPlane>();
                _airbornePlane.InitializeFlightPath(targetPosition);
                _airbornePlane.PositionReached += PositionReached;

                return(cargoPlane);
            }
コード例 #5
0
        private void CallSquad(Vector3 position)
        {
            CargoPlane leaderEnt = CreatePlane();

            leaderEnt.Spawn();

            StrikePlane leaderPlane = leaderEnt.gameObject.AddComponent <StrikePlane>();

            leaderPlane.InitializeFlightPath(position);

            Vector3 startPos;
            Vector3 endPos;
            float   secondsToTake;

            leaderPlane.GetFlightData(out startPos, out endPos, out secondsToTake);

            CargoPlane leftEnt = CreatePlane();

            leftEnt.Spawn();
            StrikePlane leftPlane  = leftEnt.gameObject.AddComponent <StrikePlane>();
            Vector3     leftOffset = (leaderEnt.transform.right * 70) + (-leaderEnt.transform.forward * 80);

            leftPlane.SetFlightData(startPos + leftOffset, endPos + leftOffset, position + (leftOffset / 4), secondsToTake);

            CargoPlane rightEnt = CreatePlane();

            rightEnt.Spawn();
            StrikePlane rightPlane  = rightEnt.gameObject.AddComponent <StrikePlane>();
            Vector3     rightOffset = (-leaderEnt.transform.right * 70) + (-leaderEnt.transform.forward * 80);

            rightPlane.SetFlightData(startPos + rightOffset, endPos + rightOffset, position + (rightOffset / 4), secondsToTake);

            if (configData.Other.Broadcast)
            {
                PrintToChat(msg("squadInbound"));
            }
        }