public override void ShootFrom(Vector3 position, Vector3 direction) { Vector3[] rayOrigins = { new Vector3(0, offset, 0) + position, new Vector3(0, offset / 2, 0) + position, position, new Vector3(0, -offset / 2, 0) + position, new Vector3(0, -offset, 0) + position, }; RaycastHit target; foreach (Vector3 pos in rayOrigins) { if (Physics.Raycast(pos, direction, out target)) { if (target.collider.CompareTag("Demon")) { DemonStats demon = target.collider.gameObject.GetComponent <DemonStats>(); demon.TakeDamage(GetEffectiveDamage(), Owner); return; } } } }
public void CreateDemon(Vector3 position, DemonTypes demonType) { GameObject demon = Instantiate(demonPrefab, position, demonPrefab.transform.rotation); demon.transform.parent = transform; Debug.Log("NIQUE TA MERE"); DemonStats demonStats = basicDemonStats; switch (demonType) { case DemonTypes.BASIC_DEMON: demonStats = basicDemonStats; break; case DemonTypes.HIGH_DEMON: demonStats = highDemonStats; break; case DemonTypes.RUSHING_DEMON: demonStats = rushingDemonStats; break; } demon.GetComponent <DemonBehavior>().SetDemonStats(demonStats); }
public void SetDemonStats(DemonStats demonStats) { demonName = demonStats.demonName; moveSpeed = demonStats.moveSpeed; bulletSpeed = demonStats.bulletSpeed; bulletScale = demonStats.bulletScale; fireRate = demonStats.fireRate; healthPoint = demonStats.healthPoint; }
void Start() { animator = GetComponent <Animator>(); target = GetComponent <DemonStats>(); if (origin == null) { origin = GameObject.FindGameObjectWithTag("Player").transform; } }
override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { hasShot = false; stats = animator.gameObject.GetComponent <DemonStats>(); controller = animator.gameObject.GetComponent <ZombiemanMovement>(); weapon = animator.gameObject.GetComponent <ZombiemanWeapon>(); controller.MoveTo(animator.transform.position); shootingTimestamp = Time.time + shootingDelay; }
override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { stats = animator.gameObject.GetComponent <DemonStats>(); controller = animator.gameObject.GetComponent <ZombiemanMovement>(); Vector3 targetDirection = (stats.GetTargetPosition() - animator.transform.position).normalized; Vector3 sidewaysVector = Vector3.Cross(targetDirection, Vector3.up).normalized; sidewaysVector *= Random.Range(0, 2) * 2 - 1; currentDirection = (targetDirection + sidewaysVector).normalized; }
public void OnGet() { demonStats = new List <DemonStats>(); using (SqlConnection connection = new SqlConnection(connectionString)) { connection.Open(); using (SqlCommand command = new SqlCommand("SELECT * FROM [RotA Demon Stats].dbo.Sheet1$", connection)) { using (SqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { DemonStats demon = new DemonStats(reader.GetValue(0).ToString()); demon.maxHp = reader.GetValue(1); demon.grabRange = reader.GetValue(2); demon.preferredAttackRange = reader.GetValue(3); demon.moveSpeed = reader.GetValue(4); demon.acceleration = reader.GetValue(5); demon.deceleration = reader.GetValue(6); demon.aggroRadius = reader.GetValue(7); demon.patrolRange = reader.GetValue(8); demon.patrolRateMin = reader.GetValue(9); demon.patrolRateMax = reader.GetValue(10); demon.hungerReducedPerMeat = reader.GetValue(11); demon.baseFearsomeness = reader.GetValue(12); demon.fearsomenessWhenAttacking = reader.GetValue(13); demon.standingHeight = reader.GetValue(14); demon.sleepingHeight = reader.GetValue(15); demon.canUseWeapons = reader.GetValue(16); demon.lovesToChase = reader.GetValue(17); demon.startingHappiness = reader.GetValue(18); demon.fallbackThreshhold = reader.GetValue(19); demon.basicAttackDamage = reader.GetValue(20); demon.buildingAttackDamage = reader.GetValue(21); demon.aoeDamage = reader.GetValue(22); demon.elementalAffinity = reader.GetValue(23); demonStats.Add(demon); } } } } }
public void Shoot(Vector3 direction) { float angle = Random.Range(-accuracyError, accuracyError) * Mathf.PI / 90; Vector3 actualDirection = new Vector3(direction.x * Mathf.Cos(angle) - direction.z * Mathf.Sin(angle), direction.y, direction.x * Mathf.Sin(angle) + direction.z * Mathf.Cos(angle)); RaycastHit target; if (Physics.Raycast(transform.position, actualDirection, out target)) { if (target.collider.CompareTag("Demon")) { DemonStats demon = target.collider.gameObject.GetComponent <DemonStats>(); demon.TakeDamage(GetEffectiveDamage(), transform); } else if (target.collider.CompareTag("Player")) { PlayerStats player = target.collider.gameObject.GetComponent <PlayerStats>(); player.TakeDamage(GetEffectiveDamage()); } } }
void Start() { animator = GetComponent <Animator>(); stats = GetComponent <DemonStats>(); previousHealth = stats.Health; }
void Start() { stats = gameObject.GetComponent<DemonStats>(); stats.tempMalice = 0.4f; LevelUp(1, stats._malice, 1, 1, 1, 1); }