Пример #1
0
    public void CallbackCannonballHit(Vector3 location)
    {
        SkillBase skillData = SkillBaseData.GetSkillBaseData(SkillNames.CANNON);
        float     radius    = skillData.radius;

        // TODO FIXME so do we want it to vary per cannonball, or per enemy hit?
        // my initiol reaction is it should be that the physical damage done to each
        // enemy is what varies, even within a single cannonball shot
        gameController.DoAOEGroundDamage(location, radius, skillData);

        // GENERATE PARTICLES :) (needs to me moved / reworked)
        // lots of optimization to happen here
        int numOfParticles = 40;

        for (int i = 0; i < numOfParticles; i++)
        {
            // create ground particles
            Vector2    particleCircle = Random.insideUnitCircle * radius;
            float      particleX      = location.x + particleCircle.x;
            float      particleZ      = location.z + particleCircle.y;
            GameObject particle       = ObjectPoolHelper.Instantiate(pGroundParticle, new Vector3(particleX, 0, particleZ), Quaternion.identity);
            particle.GetComponent <Rigidbody> ().velocity = new Vector3(0, 3, 0);

            float spin = 100f;
            particle.GetComponent <Rigidbody> ().AddTorque(new Vector3(Random.Range(-spin, spin), Random.Range(-spin, spin), Random.Range(-spin, spin)));
        }
    }
Пример #2
0
    private void CheckSkillKeyPress()
    {
        for (int i = 0; i < skillKeybinds.Count; i++)
        {
            if (Input.GetKeyDown(skillKeybinds[i]))
            {
                if (currentSkills[i] == "")
                {
                    Debug.Log("There is no skill bound to this key right now.");
                    continue;
                }

                string pressedSkillName = currentSkills[i];
                Debug.Log(pressedSkillName);
                SkillBase skillBase = SkillBaseData.GetSkillBaseData(pressedSkillName);
                GetComponent <SkillActionController> ().executeSkill(skillBase, i);
            }
        }
    }