void Start() { jumpTime = jumpOneMoreTime; jumpVector = new Vector2(0f, jumpForce); coll = GetComponent <CircleCollider2D>(); move = new Vector3(0, 0, 0); GameObject[] killers = GameObject.FindGameObjectsWithTag("PlayerKiller"); foreach (GameObject killer in killers) { PlayerKiller.BecomePK(killer); } GameObject[] stateCubes = GameObject.FindGameObjectsWithTag("ObjectStateCube"); foreach (GameObject cube in stateCubes) { ObjectState state = cube.GetComponent <ObjectState>(); if (state != null) { if (state.isState((int)ObjectState.State.BURNING | (int)ObjectState.State.ELECTRIFIED)) { PlayerKiller.BecomePK(cube); } } } }
/* * Return a new state depend on a electricity state */ public short SetStateWElec() { if ((_state & (short)State.ELECTRIFIED) == 0 && ((_state & (short)State.CONDUCTOR) != 0 || (_state & (short)State.WET) != 0)) { _conduction = _timeStayElec; _onConduction = true; _elecParticle.SetActive(true); PlayerKiller.BecomePK(gameObject); return((short)(_state + (short)State.ELECTRIFIED)); } return(_state); }
// 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); }