/// <summary> /// Shoots forward determined by the data it has, fails if timer is not ready /// </summary> /// <returns></returns> public bool Shoot() { if (!shootOrigin) { return(false); } if (!bulletPrefab) { return(false); } if (shootTimer > 0) { return(false); } Debug.Log("Shoots"); Bullet createdBulletObject = Instantiate(bulletPrefab).GetComponent <Bullet>(); Debug.Log(createdBulletObject); createdBulletObject.SetVelocityDirection(10 * transform.forward); createdBulletObject.SetOriginator(gameObject); createdBulletObject.SetDamage(damage); shootTimer = speed.Result(); return(true); }
public override bool ExecuteAttack() { if (!shootOrigin) { return(false); } if (!bulletPrefab) { return(false); } if (shootTimer > 0) { return(false); } iTween.PunchPosition(gameObject, Vector3.forward * 0.01f * attackDamage.Result(), attackSpeed.Result()); Bullet createdBulletObject = Instantiate(bulletPrefab).GetComponent <Bullet>(); createdBulletObject.transform.position = shootOrigin.transform.position; createdBulletObject.SetVelocityDirection(bulletSpeed.Result() * playerCamera.transform.forward); createdBulletObject.SetOriginator(gameObject); createdBulletObject.SetDamage(attackDamage); shootTimer = attackSpeed.Result(); TriggerOnAttack(); return(true); }
public void Result() { float expectedValue = (BASE + MODIFIER) * MULTIPLIER; testValue += testEffectValue; float result = testValue.Result(); Assert.AreEqual(expectedValue, result); }
public void Harvest() { transform.parent = null; Vector3 positionBeforeHarvest = transform.position; VirusNode currentTarget = FindNearestVirusNode(); if (agent) { ModeIcon.sprite = HarvestModeSprite; if (currentTarget && !currentTarget.harvested) { ModeIcon.color = Color.blue; Vector3 position = currentTarget.transform.position; agent.SetDestination(position); if (agent.remainingDistance <= 1) { if (interacting) { ModeIcon.color = Color.blue + Color.red; if (interactTimer <= 0) { interactOrign = transform.position + (Vector3.up * 0.61f); interactDirection = currentTarget.transform.position - interactOrign; Ray ray = new Ray(interactOrign, interactDirection); RaycastHit hit; if (Physics.Raycast(ray, out hit, 10, interactLayers)) { if (hit.collider.gameObject == currentTarget.gameObject) { currentTarget.OnInteract(); interacting = false; } } } interactTimer -= Time.deltaTime; } else { interacting = true; interactTimer = InteractSpeed.Result(); } } } else { ModeIcon.color = Color.red; currentTarget = FindNearestVirusNode(); agent.SetDestination(currentInfo.target.position); } } agent.isStopped = false; }
public bool Jump() { if (numberOfJumps > totalJumpsBeforeHittingGround) { return(false); } Vector3 bodyVelocity = body.velocity; numberOfJumps++; bodyVelocity.y = jumpPower.Result(); body.velocity = bodyVelocity; return(true); }
public override bool ExecuteAttack() { NeasestTarget(); if (timer <= 0 && currentTarget) { Bullet createdBulletObject = Instantiate(bulletPrefab).GetComponent <Bullet>(); createdBulletObject.transform.position = transform.position + Vector3.up * 0.5f; createdBulletObject.SetVelocityDirection(bulletSpeed.Result(), currentTarget.position); createdBulletObject.SetOriginator(gameObject); createdBulletObject.SetDamage(attackDamage); timer = attackSpeed.Result(); } timer -= Time.deltaTime; return(true); }
public void ApplyEffect(CustomValue amount) { maxHealth += amount; current += amount.Result(); EventReciveHealth(amount.Result()); }
private void Awake() { current = maxHealth.Result(); }
public void SetDamage(CustomValue value) { damage = value.Result(); }
public float GetSpeedValueResult() { return(speedValue.Result()); }
private void Start() { current = maxHealth.Result(); }