public Contagion TryAddContagion(Transform target) { GameObject root = target.root.gameObject; Stats targetStats = root.GetComponent <Stats>(); if (targetStats && targetStats.side != stats.side) { Contagion result = root.GetComponent <Contagion>(); if (result != null) { if (!result.active) { result.active = true; return(result); } } else { result = AddContagion(root, massNerf); result.active = true; return(result); } } return(null); }
Contagion AddContagion(GameObject targetRoot, float massNerf = 1) { Contagion result = targetRoot.gameObject.AddComponent <Contagion>(); GameObject effects = SimplePool.Spawn(contagionPrefab); effects.transform.SetParent(targetRoot.transform, false); result.Initialize(duration, massNerf, this, effects.GetComponent <ContagionEffects>()); contagions.Add(result); return(result); }
public void Awake() { //Alloc memory for contagion lambdaE = new Contagion[22]; for (int i = 0; i < lambdaE.Length; i++) lambdaE[i] = new Contagion(); InitPad(); InitEmotionContagion(); InitDefaultMood(); }
public void Awake() { //Alloc memory for contagion lambdaE = new Contagion[22]; for (int i = 0; i < lambdaE.Length; i++) { lambdaE[i] = new Contagion(); } InitPad(); InitEmotionContagion(); InitDefaultMood(); }
// Use this for initialization void Awake() { collidingAgents = new ArrayList(); //agents that are colliding with me if (!GetComponent <SteeringController>()) { gameObject.AddComponent("SteeringController"); } GetComponent <SteeringController>().maxSpeed = walkingSpeed; //maximum speed damage = new Contagion(); damage.WoundThreshold = 2f; damage.DoseThreshold = 8f; //agent dies GetComponent <PersonalityMapper>().PersonalityToSteering(); //initialize steering parameters according to personality initialPos = transform.position; }
void Update() { timePassed += Time.deltaTime; if (target == null) { // Detect colliders inside the range Collider[] insideColliders = Physics.OverlapSphere(transform.position, range); foreach (Collider col in insideColliders) { Contagion script = col.transform.gameObject.GetComponent <Contagion>(); if (script && !script.IsMasked()) { target = col; break; } } } if (target != null) { //Debug.Log(target.gameObject.name); // If the character has a mask or is too far, return Contagion script = target.transform.gameObject.GetComponent <Contagion>(); if ((script && script.IsMasked()) || Vector3.Distance(target.transform.position, transform.position) > range) { target = null; return; } else { // Rotation Vector3 targetDirection = target.transform.position - transform.position; targetDirection.y = 0; Quaternion rotation = Quaternion.LookRotation(targetDirection); transform.rotation = Quaternion.Slerp(transform.rotation, rotation, rotationSpeed * Time.deltaTime); // Fire if (timePassed > timeBetweenFire) { Fire(); timePassed = 0.0f; } } } if (shoot >= nbOfMaskToShoot) { Destroy(gameObject); } }
public override bool StartSpecialSkill(SkillCooldown sk) { if (sk.Skill.IconName == Contagion.Skill.IconName) { Contagion.Start(sk.Cooldown); return(true); } if (sk.Skill.IconName == Vow.Cooldown.Skill.IconName) { Vow.Cooldown.Start(sk.Cooldown); return(true); } return(false); }
void Cough() { coughParticles.Play(); Collider[] insideColliders = Physics.OverlapSphere(transform.position, radiusArea); foreach (Collider col in insideColliders) { //ajouter Random.Range() pour ne pas être contaminé forcement à chaque fois Contagion script = col.transform.gameObject.GetComponent <Contagion>(); if (script && script != this) { script.GetInfected(); } } cough = false; }
void Cough() { if (masked) { coughParticles.emission.SetBurst(0, new ParticleSystem.Burst(0.0f, radiusArea * 1)); } else { coughParticles.emission.SetBurst(0, new ParticleSystem.Burst(0.0f, radiusArea * 10)); } coughParticles.Play(); Collider[] insideColliders = Physics.OverlapSphere(transform.position, radiusArea); foreach (Collider col in insideColliders) { Contagion script = col.transform.gameObject.GetComponent <Contagion>(); if (script && script != this) { if (masked) { // Masqué, on n'infecte 1 fois sur 4 en moyenne if (Random.Range(0, chanceToInfectMasked) == 0) { script.GetInfected(); } } else { // Non-masqué, on n'infecte 1 fois sur 2 en moyenne if (Random.Range(0, chanceToInfect) == 0) { script.GetInfected(); } } } } cough = false; }
// Use this for initialization protected override void Start() { stats = GetComponentInParent <Stats>(); localContagion = AddContagion(this.transform.root.gameObject); base.Start(); }
// Use this for initialization void Awake() { collidingAgents = new ArrayList(); //agents that are colliding with me if(!GetComponent<SteeringController>()) gameObject.AddComponent("SteeringController"); GetComponent<SteeringController>().maxSpeed = walkingSpeed; //maximum speed damage = new Contagion(); damage.WoundThreshold = 2f; damage.DoseThreshold = 8f; //agent dies GetComponent<PersonalityMapper>().PersonalityToSteering(); //initialize steering parameters according to personality initialPos = transform.position; }
// Use this for initialization protected override void Start() { stats = GetComponentInParent<Stats>(); localContagion = AddContagion(this.transform.root.gameObject); base.Start(); }