Пример #1
0
        public static void SpikeEmpowerment(TowerModel towerModel)
        {
            var mortar = Game.instance.model.GetTowerFromId(MortarMonkey);

            towerModel.towerSelectionMenuThemeId = "MortarMonkey";

            towerModel.targetTypes = new Il2CppReferenceArray <TargetType>(mortar.targetTypes);

            if (towerModel.targetTypes.Length > 1)
            {
                while (towerModel.targetTypes.Length > 1)
                {
                    towerModel.targetTypes = towerModel.targetTypes.RemoveItemOfType <TargetType, TargetType>();
                }

                towerModel.targetTypes[0].id             = "TargetSelectedPoint";
                towerModel.targetTypes[0].intID          = -1;
                towerModel.targetTypes[0].actionOnCreate = true;
                towerModel.targetTypes[0].isActionable   = true;
            }


            towerModel.GetAttackModel().RemoveBehavior <TargetTrackModel>();
            towerModel.GetAttackModel().RemoveBehavior <SmartTargetTrackModel>();
            towerModel.GetAttackModel().RemoveBehavior <CloseTargetTrackModel>();
            towerModel.GetAttackModel().RemoveBehavior <FarTargetTrackModel>();


            var targetSelectedPointModel = towerModel.GetAttackModel().GetBehavior <TargetSelectedPointModel>();

            if (targetSelectedPointModel == null)
            {
                var tspm = new TargetSelectedPointModel("TargetSelectedPointModel_", true,
                                                        false, "4e88dd78c6e800d41a6df5b02d592082", .5f, "");
                towerModel.GetAttackModel().AddBehavior(tspm);
            }

            towerModel.UpdateTargetProviders();


            towerModel.GetDescendant <ArriveAtTargetModel>().filterCollisionWhileMoving = false;
        }