コード例 #1
0
        public bool CompareTo(Dog otherDog)
        {
            if (otherDog.ActivityLevel == Enums.EScale.None)
            {
            }
            else if (!ActivityLevel.Equals(otherDog.ActivityLevel))
            {
                return(false);
            }

            if (otherDog.SheddingLevel == Enums.EScale.None)
            {
            }
            else if (!SheddingLevel.Equals(otherDog.SheddingLevel))
            {
                return(false);
            }

            if (otherDog.GroomingLevel == Enums.EScale.None)
            {
            }
            else if (!GroomingLevel.Equals(otherDog.GroomingLevel))
            {
                return(false);
            }

            if (otherDog.IntelligenceLevel == Enums.EScale.None)
            {
            }
            else if (!IntelligenceLevel.Equals(otherDog.IntelligenceLevel))
            {
                return(false);
            }

            if (!GoodWithChildren.Equals(otherDog.GoodWithChildren))
            {
                return(false);
            }

            if (!Coatlength.Equals(otherDog.Coatlength))
            {
                return(false);
            }

            if (!Size.Equals(otherDog.Size))
            {
                return(false);
            }
            return(true);
        }
コード例 #2
0
    /*
     *  Modify the build mech obj to be ready for gameplay
     *      - Attach:
     *          - Mech, Player, Enemy Controllers scripts
     *      - Enable
     *          - CharacterController component
     */
    public void ModifyMechForGameplay(Mech mech, GameObject mechObj, bool asPlayer, Faction faction, BehaviorType behaviorType, IntelligenceLevel aiLevel)
    {
        if (asPlayer)
        {
            var PC = mechObj.AddComponent <PlayerController>();
            PC.walkSpeed = mech.mechBaseRef.baseMoveSpeed;

            mechObj.GetComponent <CharacterController>().enabled = true;
            PC.Initialize();
        }
        else
        {
            var ai = mechObj.AddComponent <AIController>();
            ai.behaviorType = behaviorType;
            ai.aiLevel      = aiLevel;
            ai.Initialize();
        }

        mechObj.GetComponent <WeaponSystem>().enabled = true;
    }
コード例 #3
0
    /*  Get Legs & Torso & Arms from MechBase
     *      - Attach accessories
     *  Get Weapons instantiate and attach
     */
    public GameObject BuildFromMechObj(Mech mech, Vector3 location, Quaternion rotation, bool modForGame, bool asPlayer, Faction faction, BehaviorType behaviorType, IntelligenceLevel aiLevel)
    {
        GameObject mechObj = Object.Instantiate(mech.mechBaseRef.basePrefab, location, rotation);

        var mechManager    = mechObj.GetComponent <MechManager>();
        var sectionManager = mechObj.GetComponent <SectionManager>();

        mechManager.Initialize();


        /* Attach weapons for each sections */
        for (int secIndex = (int)SectionIndex.leftArm; secIndex < (int)SectionIndex.rightShoulder; secIndex++)
        {
            /* Get the ItemStruct for each section */
            ItemStruct refStruct = mech.GetSectionItemsByIndex(secIndex);

            /* Build from WeaponStruct */
            int subIndex = 0;
            foreach (WeaponItem wItem in refStruct.primary)
            {
                if (subIndex >= sectionManager.GetSectionLinksByIndex(secIndex, 0).Length)
                {
                    Debug.Log("Too many weapons to links in sec " + secIndex + " primary weapons ");
                    break;
                }

                BuildClassWeapon(wItem, mechManager, sectionManager, secIndex, subIndex, 0);
                subIndex++;
            }

            subIndex = 0;
            foreach (WeaponItem wItem in refStruct.secondary)
            {
                if (subIndex >= sectionManager.GetSectionLinksByIndex(secIndex, 1).Length)
                {
                    break;
                }

                BuildClassWeapon(wItem, mechManager, sectionManager, secIndex, subIndex, 1);
                subIndex++;
            }

            subIndex = 0;
            foreach (WeaponItem wItem in refStruct.tertiary)
            {
                if (subIndex >= sectionManager.GetSectionLinksByIndex(secIndex, 2).Length)
                {
                    break;
                }

                BuildClassWeapon(wItem, mechManager, sectionManager, secIndex, subIndex, 2);
                subIndex++;
            }
        }

        /* Set relevant stats */
        mechManager.baseMoveSpeed = mech.mechBaseRef.baseMoveSpeed;
        mechManager.mechFaction   = faction;

        if (modForGame)
        {
            ModifyMechForGameplay(mech, mechObj, asPlayer, faction, behaviorType, aiLevel);
        }

        // TODO: Outlines

        return(mechObj);
    }