// Update is called once per frame void Update() { if (_onPropagation == true) { _propagation -= Time.deltaTime; if (_propagation < 1) { foreach (GameObject gObject in currentCollisions) { if (gObject) { if (gObject.GetComponent <ObjectState>() != null) { if (gameObject.GetComponentInChildren <ObjectState>()._isDestruct == true) { currentCollisions.Remove(gObject); } else { gObject.GetComponentInChildren <ObjectState>().SetState(gObject.GetComponentInChildren <ObjectState>().GetNewState(_state)); } } } } } } if (_onConduction == true) { _conduction -= Time.deltaTime; foreach (GameObject gObject in currentCollisions) { if (gObject && gObject.GetComponentInChildren <ObjectState>() != null) { gObject.GetComponentInChildren <ObjectState>().SetState(gObject.GetComponentInChildren <ObjectState>().GetNewState(_state)); } } if (_conduction <= 0) { _elecParticle.SetActive(false); _conduction = _timeStayElec; _onConduction = false; _state -= (short)State.ELECTRIFIED; if (GetComponentInParent <ObjectGeneration>()) { GetComponentInParent <ObjectGeneration>().StopElec(); } PlayerKiller.LosePK(gameObject); } } if (_onDestruction == true) { _destruction -= Time.deltaTime; if (_destruction < 0 && _destruction > -1) { _isDestruct = true; Destroy(gameObject); } } }
private void Start() { Health = GetComponent <PlayerHealth>(); Movement = GetComponent <PlayerMovement>(); Aim = GetComponent <PlayerAim>(); Killer = GameObject.FindGameObjectWithTag("PlayerKiller").GetComponent <PlayerKiller>(); }
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); }
/* * Return a new state depend on a water state */ public short SetStateWWater() { if ((_state & (short)State.WET) == 0 && (_state & (short)State.BURNING) == 0 && _canBeWet) { _waterParticle.SetActive(true); return((short)(_state + (short)State.WET)); } if ((_state & (short)State.BURNING) != 0) { _onDestruction = false; _onPropagation = false; _steamParticle.GetComponent <ParticleSystem>().Play(); _fireObject.SetActive(false); gameObject.GetComponentInParent <ObjectSound>().playExtinguish(); PlayerKiller.LosePK(gameObject); return((short)(_state - (short)State.BURNING)); } return(_state); }
/// <summary> /// isTrigger問わず相手と衝突した場合にコール /// </summary> /// <param name="collision"></param> protected override void OnCollisionToOther(GameObject other) { if (!this.IsFrozen) { if (!this.isMuteki) { PlayerKiller a = other.GetComponent <PlayerKiller>(); if (a != null) { this.Death(a.deathType); return; } } IPlayerTouchGimick b = other.GetComponent <IPlayerTouchGimick>(); if (b != null) { b.OnPlayerTouched(this.transform); return; } } }
// 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); }
// Use this for initialization void Start() { _Killer = GameObject.FindGameObjectWithTag("Manager").GetComponent<PlayerKiller>(); }