Beispiel #1
0
        //a method that converts this unit to the converter's faction, locally
        public void ConvertLocal(Unit converter, int targetFactionID)
        {
            CustomEvents.OnUnitConversionStart(converter, this);

            Disable(false);                                                //remove it first from its current faction

            AssignFaction(gameMgr.GetFaction(targetFactionID).FactionMgr); //assign the new faction

            if (converter)                                                 //if there's a source converter
            {
                converter.ConverterComp.EnableConvertEffect();             //enable the conversion effect on the converter
            }
            //deselect the unit if it was selected:
            if (selection.IsSelected)
            {
                gameMgr.SelectionMgr.Selected.Remove(this);
            }

            CustomEvents.OnUnitConversionComplete(converter, this); //trigger the custom event
        }