sc2_techtree/cost.rs
1//! Cost of an action
2
3use noisy_float::prelude::*;
4use serde::{Deserialize, Serialize};
5
6/// Cost
7#[derive(Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq, Hash, Default)]
8pub struct Cost {
9 // Mineral cost
10 minerals: u32,
11 // Vespene gas cost
12 gas: u32,
13 // Time cost
14 time: Option<R32>,
15}
16impl Cost {
17 /// Is the action free (by mineral cost)
18 pub fn is_free(&self) -> bool {
19 self.minerals == 0 && self.gas == 0
20 }
21}