Exemple #1
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.tag == "CorePart")
        {
            CorePart i_corePart = other.GetComponent <CorePart>();
            //Find retriever of the alive player
            if (GameManager.alivePlayers.Count <= 1)
            {
                Retriever r = GameManager.alivePlayers[0].GetComponentInChildren <Retriever>();
                r.RetrieveCorePart(i_corePart);
            }
        }

        if (other.tag == "Player")
        {
            PlayerController player = other.GetComponent <PlayerController>();
            if (player == null)
            {
                return;
            }
            player.KillWithoutCorePart();
            if (GameManager.alivePlayers.Count <= 1)
            {
                Retriever r = GameManager.alivePlayers[0].GetComponentInChildren <Retriever>();
                r.AllowPlayerRevive(player);
            }
        }
    }
Exemple #2
0
        internal static void Reset()
        {
            _missions = new MissionInfo[5];
            for (int i = 0; i < 5; i++)
            {
                var missionInfo = new MissionInfo();
                missionInfo.MapWidth    = Math.Min(100 + 10 * i, 150);
                missionInfo.MapHeight   = Math.Min(100 + 10 * i, 150);
                missionInfo.Difficulty  = i + 1;
                missionInfo.Enemies     = i + 1;
                missionInfo.RewardScrap = (int)(Rand.Next(50, 70) * EngineConsts.REPAIR_COST * (1 + 0.5 * i));
                missionInfo.RewardPart  = PartFactory.BuildRandom();
                _missions[i]            = missionInfo;
            }

            Blueprint  = new PartHandler(PartFactory.BuildSmallCore());
            AvailCores = new List <CorePart>()
            {
                PartFactory.BuildSmallCore()
            };

            var l1 = PartFactory.BuildLeg();

            l1.Center = new Loc(-2, 0);
            var l2 = PartFactory.BuildLeg();

            l2.Center = new Loc(2, 0);

            var m1 = PartFactory.BuildSmallMissile(true);
            var m2 = PartFactory.BuildSmallMissile(false);

            AvailParts = new List <Part>()
            {
                m1, m2,
                l1, l2
            };
            NextMission = GenerateMission();

            Scrap      = 0;
            Difficulty = 0;
            Year       = Game.Rand.Next(2100, 2200);

            Hangar = new List <PartHandler>();
            CorePart core = Game.AvailCores[0];
            Part     w1   = Game.AvailParts[0];
            Part     w2   = Game.AvailParts[1];

            var ph = new PartHandler(core);

            for (int i = 0; i < Game.AvailParts.Count; i++)
            {
                ph.Add(Game.AvailParts[i]);
            }
            ph.WeaponGroup.Add(w1, 0);
            ph.WeaponGroup.Add(w2, 0);
            Hangar.Add(ph);
            MechIndex = 0;

            _dead = false;
        }
Exemple #3
0
    public void RetrieveCorePart(CorePart i_corePart)
    {
        i_corePart.Pick(playerController);
        FeedbackManager.SendFeedback("event.PlayerPickingBodyPart", playerController, i_corePart.transform.position, i_corePart.transform.position - transform.position, i_corePart.transform.position - transform.position);
        bool i_partsFound = false;
        List <ReviveInformations> newList = new List <ReviveInformations>();

        foreach (ReviveInformations i_parts in retrievedParts)
        {
            if (i_parts.linkedPlayer == i_corePart.linkedPawn)
            {
                i_partsFound = true;
                i_parts.amount++;
                if (i_parts.amount >= i_parts.maxAmount)
                {
                    AllowPlayerRevive(i_parts);
                }
                else
                {
                    i_parts.linkedPanel.transform.Find("TextHolder").transform.Find("Amount").GetComponent <TextMeshProUGUI>().text = i_parts.amount + "/" + i_parts.maxAmount;
                    i_parts.linkedPanel.GetComponent <Animator>().SetTrigger("showAmount");
                    newList.Add(i_parts);
                }
            }
            else
            {
                newList.Add(i_parts);
            }
        }
        retrievedParts = newList;
        if (!i_partsFound)
        {
            ReviveInformations i_newPart = new ReviveInformations();
            i_newPart.linkedPlayer = (PlayerController)i_corePart.linkedPawn;
            i_newPart.maxAmount    = i_corePart.totalPartCount;
            i_newPart.amount       = 1;
            i_newPart.linkedPanel  = Instantiate(Resources.Load <GameObject>("PlayerResource/CollectedPartsPanel"), GameManager.mainCanvas.transform).GetComponent <AssemblingPartPanel>();
            i_newPart.linkedPanel.revivedPlayer  = i_newPart.linkedPlayer;
            i_newPart.linkedPanel.revivingPlayer = playerController;
            i_newPart.linkedPanel.Init();
            i_newPart.linkedPanel.transform.Find("TextHolder").transform.Find("Amount").GetComponent <TextMeshProUGUI>().text = i_newPart.amount + "/" + i_corePart.totalPartCount;
            retrievedParts.Add(i_newPart);
        }
    }
Exemple #4
0
 private void OnTriggerStay(Collider other)
 {
     if (other.tag == "CorePart" && playerController)
     {
         CorePart i_corePart = other.GetComponent <CorePart>();
         if (!i_corePart.grounded)
         {
             return;
         }
         if (!i_corePart.CanBePicked())
         {
             return;
         }
         if (i_corePart.linkedPawn != null)
         {
             RetrieveCorePart(i_corePart);
         }
         else
         {
             i_corePart.Pick(playerController);
             playerController.Heal(i_corePart.healthValue);
         }
     }
 }