Exemplo n.º 1
0
    /// <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);
    }
Exemplo n.º 2
0
    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);
    }
Exemplo n.º 3
0
        public void Result()
        {
            float expectedValue = (BASE + MODIFIER) * MULTIPLIER;

            testValue += testEffectValue;

            float result = testValue.Result();

            Assert.AreEqual(expectedValue, result);
        }
Exemplo n.º 4
0
    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;
    }
Exemplo n.º 5
0
    public bool Jump()
    {
        if (numberOfJumps > totalJumpsBeforeHittingGround)
        {
            return(false);
        }

        Vector3 bodyVelocity = body.velocity;

        numberOfJumps++;
        bodyVelocity.y = jumpPower.Result();
        body.velocity  = bodyVelocity;
        return(true);
    }
Exemplo n.º 6
0
 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);
 }
Exemplo n.º 7
0
 public void ApplyEffect(CustomValue amount)
 {
     maxHealth += amount;
     current   += amount.Result();
     EventReciveHealth(amount.Result());
 }
Exemplo n.º 8
0
 private void Awake()
 {
     current = maxHealth.Result();
 }
Exemplo n.º 9
0
 public void SetDamage(CustomValue value)
 {
     damage = value.Result();
 }
Exemplo n.º 10
0
 public float GetSpeedValueResult()
 {
     return(speedValue.Result());
 }
Exemplo n.º 11
0
 private void Start()
 {
     current = maxHealth.Result();
 }