// Use this for initialization void Start() { if (transform.FindChild("FirePropagation")) { _fireObject = transform.FindChild("FirePropagation").gameObject; } if (transform.FindChild("WaterStateParticle")) { _waterParticle = transform.FindChild("WaterStateParticle").gameObject; } if (transform.FindChild("SteamParticle")) { _steamParticle = transform.FindChild("SteamParticle").gameObject; } if (transform.FindChild("ElecStateParticle")) { _elecParticle = transform.FindChild("ElecStateParticle").gameObject; } _pos = transform.position; if (_onPropagation == true) { _propagation = _timeToPropagate; _fireObject.SetActive(true); if (GetComponentInChildren <FirePropagation>()) { _fireProp = GetComponentInChildren <FirePropagation>(); _fireProp.SetPosition(_pos); _fireProp.Begin(); } PlayerKiller.BecomePK(gameObject); } if (_onDestruction == true) { _destruction = _timeToDestroy; } _isDestruct = false; }
/* * Return a new state depend on a fire state */ public short SetStateWFire() { if ((_state & (short)State.WET) != 0) { _waterParticle.SetActive(false); _steamParticle.GetComponent <ParticleSystem>().Play(); _propagation = _timeToPropagate; return((short)(_state - (short)State.WET)); } else if ((_state & (short)State.FLAMMABLE) != 0 && (_state & (short)State.BURNING) == 0) { _propagation = _timeToPropagate; _destruction = _timeToDestroy; _onDestruction = true; _onPropagation = true; if (GetComponentInParent <ObjectGeneration>()) { GetComponentInParent <ObjectGeneration>()._isInFire = true; } _waterParticle.SetActive(false); _fireObject.SetActive(true); if (GetComponentInChildren <FirePropagation>()) { _fireProp = GetComponentInChildren <FirePropagation>(); _fireProp.Begin(); _fireProp.SetPosition(_pos); } if (gameObject.GetComponentInParent <ObjectSound>()) { gameObject.GetComponentInParent <ObjectSound>().playBurning(); } PlayerKiller.BecomePK(gameObject); return((short)(_state + (short)State.BURNING)); } return(_state); }