public void ReplaceSpiltInfo(SpiltInfo newValue)
    {
        var index     = GameComponentsLookup.SpiltInfo;
        var component = CreateComponent <SpiltInfoComponent>(index);

        component.value = newValue;
        ReplaceComponent(index, component);
    }
Exemplo n.º 2
0
    /// <summary>
    /// 创建敌人死亡后的涂鸦
    /// </summary>
    /// <param name="uid"></param>
    /// <param name="spawnPos"></param>
    /// <param name="typeIndex"></param>
    /// <returns></returns>
    public GameEntity CreateSpilt(ulong uid, Vector2 spawnPos, int typeIndex)
    {
        CheckDuplicateEntity(uid);
        GameEntity gameEntity = context.CreateEntity();

        gameEntity.AddUID(uid);
        gameEntity.AddUnitType(UnitType.Spilt);
        gameEntity.AddPosition(spawnPos);

        Quaternion randomQuaternion = Quaternion.Euler(0, 0, MathUtils.RandomFloat(0, 360));

        gameEntity.AddRotation(randomQuaternion);
        gameEntity.AddEnemyState(EnemyState.None);

        SpiltInfo spiltInfo = configService.GetSpiltInfo();

        gameEntity.AddSpiltInfo(spiltInfo);
        gameEntity.AddColorType(typeIndex);

        gameEntity.AddAsset("Spilt");

        return(gameEntity);
    }