Beispiel #1
0
    public void CreateShip(CharacterTypeEnum characterType, long shipId, Action callBack)
    {
        CptUtil.RemoveChild(transform);

        GameLevelBean gameLevelData = handler_Game.GetGameLevelData();
        GameBean      gameData      = handler_Game.GetGameData();

        switch (characterType)
        {
        case CharacterTypeEnum.Player:
            manager.GetShipDataById((shipData) =>
            {
                shipData.ship_damage     = gameData.playerForDamage;
                shipData.characterType   = CharacterTypeEnum.Player;
                shipData.intervalForFire = handler_GameData.GetFireCD();
                StartCoroutine(CoroutineForCreateShip(shipData, callBack));
            }, shipId);
            break;

        case CharacterTypeEnum.Enemy:
            manager.GetShipDataById((shipData) =>
            {
                shipData.intervalForFire    = gameLevelData.enemy_fire_interval;
                shipData.characterType      = CharacterTypeEnum.Enemy;
                shipData.limitForFireNumber = gameLevelData.enemy_fire_limit_number;
                StartCoroutine(CoroutineForCreateShip(shipData, callBack));
            }, shipId);
            break;
        }
    }