// Use this for initialization void Start() { cm = GetComponent <ConfigManager> (); rb = GetComponent <Rigidbody>(); actionController = GetComponentInChildren <ActionsNew> (); // load value from config file if they exist. Otherwise use the defaults from the unity editor. cm = GameObject.Find("Configuration").GetComponent <ConfigManager>(); // GetComponent<ConfigManager> (); MoveSpeed = (float)Double.Parse(cm.Load("MoveSpeed")); JumpSpeed = (float)Double.Parse(cm.Load("JumpSpeed")); JumpDepletionAmount = (float)Double.Parse(cm.Load("JumpDepletionAmount")); RunDepletionRate = (float)Double.Parse(cm.Load("RunDepletionRate")); BreathRecoveryTimeout = Int32.Parse(cm.Load("BreathRecoveryTimeout")); BreathRecoveryRate = (float)Double.Parse(cm.Load("BreathRecoveryRate")); if (isWinter) { recoverModifier = WINTER_PENALTY / 100; //if its winter then recovery is 25% less than normal } PufferBreathRecovered = (float)Double.Parse(cm.Load("PufferBreathRecovered")) * recoverModifier; MaxBreath = (float)Double.Parse(cm.Load("MaxBreath")); MaxPufferCharge = (float)Double.Parse(cm.Load("MaxPufferCharge")); PufferCostSelf = (float)Double.Parse(cm.Load("PufferCostSelf")); PufferCostSpray = (float)Double.Parse(cm.Load("PufferCostSpray")); this.transform.position = GameObject.Find("LevelStart").transform.position + new Vector3(0.0f, 0.5f, 0.0f); currentBreath = MaxBreath; currentPufferCharge = MaxPufferCharge; }
// Use this for initialization void Start() { actionController = GetComponentInChildren <ActionsNew> (); rb = GetComponent <Rigidbody>(); pm = GetComponent <PlayerManager>(); //set dest //set spawn pos SpawnPosition = new Vector3(Random.Range(0f, 50f), 0f, Random.Range(0f, 50f)); Destination = new Vector3(Random.Range(0f, 50f), 0f, Random.Range(0f, 50f)); if (Destination == SpawnPosition) { Start(); } transform.position = SpawnPosition; }
// Use this for initialization void Start() { cm = GetComponent<ConfigManager> (); rb = GetComponent<Rigidbody>(); actionController = GetComponentInChildren<ActionsNew> (); // load value from config file if they exist. Otherwise use the defaults from the unity editor. cm = GameObject.Find ("Configuration").GetComponent <ConfigManager>();// GetComponent<ConfigManager> (); MoveSpeed = (float)Double.Parse(cm.Load ("MoveSpeed")); JumpSpeed = (float)Double.Parse(cm.Load ("JumpSpeed")); JumpDepletionAmount = (float)Double.Parse(cm.Load ("JumpDepletionAmount")); RunDepletionRate = (float)Double.Parse(cm.Load ("RunDepletionRate")); BreathRecoveryTimeout = Int32.Parse(cm.Load ("BreathRecoveryTimeout")); BreathRecoveryRate = (float)Double.Parse(cm.Load ("BreathRecoveryRate")); if (isWinter) recoverModifier = WINTER_PENALTY/100; //if its winter then recovery is 25% less than normal PufferBreathRecovered = (float)Double.Parse(cm.Load ("PufferBreathRecovered"))*recoverModifier; MaxBreath = (float)Double.Parse(cm.Load ("MaxBreath")); MaxPufferCharge = (float)Double.Parse(cm.Load ("MaxPufferCharge")); PufferCostSelf = (float)Double.Parse(cm.Load ("PufferCostSelf")); PufferCostSpray = (float)Double.Parse(cm.Load ("PufferCostSpray")); this.transform.position = GameObject.Find ("LevelStart").transform.position + new Vector3 (0.0f, 0.5f, 0.0f); currentBreath = MaxBreath; currentPufferCharge = MaxPufferCharge; }