Beispiel #1
0
    private void Start()
    {
        Debug.Log("Setting up aircraft noise!");
        pitchOffset    = UnityEngine.Random.Range(-10f, 10f);
        yawOffset      = UnityEngine.Random.Range(-10f, 10f);
        rollOffset     = UnityEngine.Random.Range(-10f, 10f);
        throttleOffset = UnityEngine.Random.Range(-10f, 10f);

        pitchTimeOffset    = UnityEngine.Random.Range(-60f, 60f);
        yawTimeOffset      = UnityEngine.Random.Range(-60f, 60f);
        rollTimeOffset     = UnityEngine.Random.Range(-60f, 60f);
        throttleTimeOffset = UnityEngine.Random.Range(-60f, 60f);

        ap = GetComponent <AutoPilot>();
        if (CheesesAITweaks.apToHelper.ContainsKey(ap) == false)
        {
            CheesesAITweaks.apToHelper.Add(ap, this);
        }

        ai = GetComponent <AIPilot>();
        if (CheesesAITweaks.aiToHelper.ContainsKey(ai) == false)
        {
            CheesesAITweaks.aiToHelper.Add(ai, this);
        }

        rb = GetComponent <Rigidbody>();
        rp = GetComponent <RefuelPlane>();

        largeAircraft = ai.parkingSize >= 20;

        if (largeAircraft)
        {
            frequncy = CheesesAITweaks.settings.controlNoiseLargeAircraftFrequency;
        }
        else
        {
            frequncy = CheesesAITweaks.settings.controlNoiseFrequency;
        }
    }
Beispiel #2
0
 public TrafficTask_CAP_Refuel(string newName, RefuelPlane refuelPlane) : base(newName)
 {
     maxPerTask       = 1;
     this.refuelPlane = refuelPlane;
 }
Beispiel #3
0
        RefuelPlane FindRefuelTanker()
        {
            RefuelPlane result = UnityEngine.Object.FindObjectsOfType <RefuelPlane>()[0];

            return(result);
        }
Beispiel #4
0
    public TrafficTask_Transport_Refuel(string newName, RefuelPlane refuelPlane) : base(newName)
    {
        this.refuelPlane = refuelPlane;

        maxPerTask = AirTraffic.maxAircraftPerRefuelTask;
    }
Beispiel #5
0
        public override string Command(PilotCommand command, List <string> args)
        {
            AIAircraftSpawn aircraftSpawn = (AIAircraftSpawn)unitSpawn;

            switch (command)
            {
            case PilotCommand.Attack:
                Actor target = GetActor(args[0]);
                if (target != null)
                {
                    aircraftSpawn.AttackTarget(GetUnitReference(target));

                    return("Attacking " + target.name + "!");
                }
                else
                {
                    return("No such target " + args[0] + " exists.");
                }

            case PilotCommand.Cancel:
                aircraftSpawn.CancelAttackTarget();
                return("Canceling attack.");

            case PilotCommand.Orbit:
                Actor target2 = GetActor(args[0]);
                if (target2 != null)
                {
                    waypoint.GetTransform().position = target2.position;
                    aircraftSpawn.SetOrbitNow(waypoint, 5000, 5000);
                    return("Orbiting  " + target2.name + "!");
                }
                else
                {
                    return("No such target " + args[0] + " exists.");
                }

            case PilotCommand.Formation:
                Actor target3 = GetActor(args[0]);
                if (target3 != null)
                {
                    aircraftSpawn.FormOnPilot(GetUnitReference(target3));
                    return("Following  " + target3.name + "!");
                }
                else
                {
                    return("No such target " + args[0] + " exists.");
                }

            case PilotCommand.TakeOff:
                aircraftSpawn.TakeOff();
                return("Taking off!");

            case PilotCommand.RTB:
                aircraftSpawn.RearmAt(new AirportReference(args[0]));
                return("Landing!");

            case PilotCommand.A2ARefuel:
                RefuelPlane rp = FindRefuelTanker();
                if (rp != null)
                {
                    aircraftSpawn.RefuelWithUnit(GetUnitReference(rp.actor));
                    return("Refueling!");
                }
                else
                {
                    return("Found no refuel plane.");
                }

            case PilotCommand.Bomb:
                Actor target4 = GetActor(args[0]);
                if (target4 != null)
                {
                    waypoint.GetTransform().position = target4.position;
                    aircraftSpawn.BombWaypoint(waypoint, UnityEngine.Random.Range(0f, 360f), 5, aircraftSpawn.aiPilot.defaultAltitude);
                    return("Bombing " + target4.name + "!");
                }
                else
                {
                    return("No such target " + args[0] + " exists.");
                }

            case PilotCommand.CM:
                aircraftSpawn.CountermeasureProgram(true, true, 3, 0.2f);
                return("Deploying CMs!");

            case PilotCommand.Flare:
                aircraftSpawn.CountermeasureProgram(true, false, 3, 0.2f);
                return("Deploying flares!");

            case PilotCommand.Chaff:
                aircraftSpawn.CountermeasureProgram(false, true, 3, 0.2f);
                return("Deploying chaff!");

            case PilotCommand.JetisonEmpty:
                wm.MarkEmptyToJettison();
                wm.JettisonMarkedItems();
                return("Jettisoning empty!");

            case PilotCommand.JetisonFuel:
                wm.MarkDroptanksToJettison();
                wm.JettisonMarkedItems();
                return("Jettisoning droptanks!");

            case PilotCommand.Jetison:
                wm.MarkAllJettison();
                wm.JettisonMarkedItems();
                return("Jettisoning all weapons!");

            case PilotCommand.Eject:
                actor.health.Kill();
                return("Punch out!");

            case PilotCommand.Kamikaze:
                Actor target5 = GetActor(args[0]);
                if (target5 != null)
                {
                    if (target5.role == Actor.Roles.Ground || target5.role == Actor.Roles.GroundArmor || target5.role == Actor.Roles.Ship)
                    {
                        aircraftSpawn.aiPilot.gunRunMinAltitude      = float.MinValue;
                        aircraftSpawn.aiPilot.gunGroundMaxRange      = 50;
                        aircraftSpawn.aiPilot.minAltClimbThresh      = float.MinValue;
                        aircraftSpawn.aiPilot.minAltitude            = float.MinValue;
                        aircraftSpawn.aiPilot.obstacleCheckAheadTime = 0;
                        wm.MarkAllJettison();
                        wm.JettisonMarkedItems();
                        aircraftSpawn.AttackTarget(GetUnitReference(target5));
                        return("BANZAI!");
                    }
                    else
                    {
                        return("Can only kamikaze ground targets.");
                    }
                }
                else
                {
                    return("No such target " + args[0] + " exists.");
                }

            default:
                return(base.Command(command, args));
            }
        }