Example #1
0
    private void OnTriggerEnter(Collider other)
    {
        HotAirBalloon hotAirBalloon = other.GetComponentInParent <HotAirBalloon>();

        if (hotAirBalloon)
        {
            Rigidbody rb = hotAirBalloon.GetRigidbody();
            Destroy(rb);
            StartCoroutine(LandBalloon(hotAirBalloon.transform));
        }
    }
    public static void Main()
    {
        // Build a collection of all vehicles that fly
        HotAirBalloon balloon1 = new HotAirBalloon();
        HotAirBalloon balloon2 = new HotAirBalloon();

        List <IAirbased> flyingstuff = new List <IAirbased>();

        flyingstuff.Add(balloon1);
        flyingstuff.Add(balloon2);

        // With a single `foreach`, have each vehicle Fly()
        foreach (IAirbased item in flyingstuff)
        {
            item.Fly();
        }

        // Build a collection of all vehicles that operate on roads
        Motorcycle motorcycle1 = new Motorcycle();
        Motorcycle motorcycle2 = new Motorcycle();
        Hatchback  hondafit    = new Hatchback();
        Cessna     planecar    = new Cessna();

        List <IGroundbased> groundstuff = new List <IGroundbased>();

        groundstuff.Add(motorcycle1);
        groundstuff.Add(motorcycle2);
        groundstuff.Add(hondafit);
        groundstuff.Add(planecar);

        // With a single `foreach`, have each road vehicle Drive()
        foreach (IGroundbased item in groundstuff)
        {
            item.Drive();
        }

        // Build a collection of all vehicles that operate on water
        JetSki jetski1 = new JetSki();
        JetSki jetski2 = new JetSki();

        List <IWaterbased> waterstuff = new List <IWaterbased>();

        waterstuff.Add(jetski1);
        waterstuff.Add(jetski2);

        // With a single `foreach`, have each water vehicle Drive()
        foreach (IWaterbased item in waterstuff)
        {
            item.Drive();
        }
    }
Example #3
0
    void Start()
    {
        cheatmode = FindObjectOfType <HotAirBalloon>();

        viewer = FindObjectOfType <CameraMovement>().transform;

        sidewaysSpeed = new AxisSpeed("X", 1, SpeedBuildup, SpeedFalloff);
        forwardSpeed  = new AxisSpeed("Y", 1, SpeedBuildup, SpeedFalloff);

        directions = new List <AxisSpeed>();
        directions.Add(sidewaysSpeed);
        directions.Add(forwardSpeed);

        rb = GetComponent <Rigidbody>();
        c  = GetComponent <Climber>();
        g  = GetComponentInChildren <GroundChecker>();
    }
Example #4
0
    private void OnTriggerEnter(Collider other)
    {
        HotAirBalloon hotAirBalloon = other.GetComponentInParent <HotAirBalloon>();

        if (hotAirBalloon)
        {
            GameState.NewMilkBottles += 1;
            Destroy(this);

            CollectibleCollectEffect effect = GetComponent <CollectibleCollectEffect>();
            if (effect)
            {
                effect.BeginEffect(hotAirBalloon);
            }
            else
            {
                GetComponent <Transform>().localScale = Vector3.zero;
            }
        }
    }
 public void BeginEffect(HotAirBalloon hotAirBalloon)
 {
     StartCoroutine(MoveToTransform(hotAirBalloon.GetBasketTransform()));
 }
Example #6
0
        private object CanSamSiteShoot(SamSite samSite)
        {
            if (samSite == null)
            {
                return(false);
            }

            List <BasePlayer> targetPlayers = new List <BasePlayer>();

            switch (samSite.currentTarget.prefabID)
            {
            case 2278499844:     //minicopter
                MiniCopter      targetCopter = samSite.currentTarget as MiniCopter;
                BaseVehicleSeat driverSeat   = null;
                //if (targetCopter == null) PrintToChat("copter not found");
                if (targetCopter != null)
                {
                    driverSeat = targetCopter.GetComponentsInChildren <BaseVehicleSeat>()[0];
                }
                //if (driverSeat == null) PrintToChat("seat not found");
                if (driverSeat != null)
                {
                    targetPlayers.Add(driverSeat._mounted);
                }
                break;

            case 3111236903:     //hotairballoon
                HotAirBalloon targetBalloon = samSite.currentTarget as HotAirBalloon;
                Vis.Entities(targetBalloon.transform.position, 2, targetPlayers);
                break;

            default:
                return(false);
            }

            if (targetPlayers.Count == 0)
            {
                return(null);
            }

            //calculate distance
            float distance = Vector3.Distance(samSite.transform.position, samSite.currentTarget.transform.position);

            //warning
            if (distance > firingRange)
            {
                foreach (var player in targetPlayers)
                {
                    //player.ChatMessage(warningMsg);
                    GUIAnnouncements?.Call("CreateAnnouncement", getCustomMsg(false, samSite.GetInstanceID()), "grey", "white", player);
                    return(false);
                }
            }

            //firing
            else
            {
                foreach (var player in targetPlayers)
                {
                    //player.ChatMessage(firingMsg);
                    GUIAnnouncements?.Call("CreateAnnouncement", getCustomMsg(true, samSite.GetInstanceID()), "red", "white", player);
                    return(null);
                }
            }
            return(false);
        }
Example #7
0
 private object OnEntityTakeDamage(HotAirBalloon entity, HitInfo hitInfo) =>
 ProcessDecayDamage(entity, hitInfo);