コード例 #1
0
    public void ReApplyStats(StatPack powerups)
    {
        StatPack newStats = StatPack.ApplyToBase(baseStats, powerups);

        maxHealth    = newStats.GetAdd(StatPack.StatType.Health);
        maxNO2       = newStats.GetAdd(StatPack.StatType.Nitro);
        currentArmor = newStats.GetAdd(StatPack.StatType.Armor);
        controller.GetCar().GetComponent <Rigidbody2D>().mass = newStats.GetAdd(StatPack.StatType.Weight);
        controller.GetCar().GetComponent <Driving>().topSpeed = newStats.GetAdd(StatPack.StatType.TopSpeed);
        controller.GetCar().GetComponent <Driving>().staticCoefficientOfFriction = newStats.GetAdd(StatPack.StatType.Grip);
        controller.GetCar().GetComponent <Driving>().acceleration = newStats.GetAdd(StatPack.StatType.Acceleration);
        GarageStats.SetCurrentStats(newStats);
    }
コード例 #2
0
    public void SetupPlayer()
    {
        baseStats = new StatPack();
        baseStats.SetAdd(StatPack.StatType.Health, 100);
        baseStats.SetAdd(StatPack.StatType.Nitro, 100);

        baseStats.SetAdd(StatPack.StatType.Weight, controller.GetCar().GetComponent <Rigidbody2D>().mass);
        baseStats.SetAdd(StatPack.StatType.TopSpeed, controller.GetCar().GetComponent <Driving>().topSpeed);
        baseStats.SetAdd(StatPack.StatType.Grip, controller.GetCar().GetComponent <Driving>().staticCoefficientOfFriction);
        baseStats.SetAdd(StatPack.StatType.Acceleration, controller.GetCar().GetComponent <Driving>().acceleration);
        GarageStats.SetBaseStats(baseStats);
        GarageStats.SetCurrentStats(baseStats);
    }