コード例 #1
0
ファイル: Repel.cs プロジェクト: DrMikeCooper/RPG
 public override void UpdateStatus(Prop ch)
 {
     ch.transform.position += Time.deltaTime * velocity * direction;
 }
コード例 #2
0
ファイル: DamageOverTime.cs プロジェクト: DrMikeCooper/RPG
 public override void Apply(Prop ch, Character caster = null)
 {
 }
コード例 #3
0
        void OnTriggerEnter(Collider col)
        {
            HitResponse.ReflectionType deflect = HitResponse.ReflectionType.None;
            bool finished = true;

            Prop ch = col.gameObject.GetComponent <Prop>();

            if (ch != caster)
            {
                if (ch)
                {
                    // check to see if we deflect it first
                    deflect = ch.GetReflection(parentPower.type);

                    bool apply    = (deflect == HitResponse.ReflectionType.None);
                    bool bounce   = !apply;
                    bool chaining = false;

                    if (chains < (parentPower as PowerProjectile).maxChains)
                    {
                        chains++;
                        bounce   = true;
                        chaining = true;
                        deflect  = HitResponse.ReflectionType.Redirect;
                    }

                    if (apply)
                    {
                        // apply the power normally

                        // bullshit correction because the coordinates are coming out weird here
                        Vector3 pos = ch.transform.position;
                        pos.y = 0;
                        ch.transform.position = pos;

                        // if we miss (based on accuracy), set the flag here so we dont destroy the projectile
                        if (!parentPower.Apply(ch, charge, caster as Character, doStatus))
                        {
                            finished = false;
                        }
                    }

                    if (bounce)
                    {
                        finished = false;
                        // reverse direction for now
                        int       team = -1;
                        Character cha  = (chaining ? caster : ch) as Character;
                        if (cha)
                        {
                            team = cha.team;
                        }
                        float speed = velocity.magnitude;
                        velocity = speed * HitResponse.Reflect(ch, caster.transform.position, deflect, team);

                        startPos = transform.position;
                        if (!chaining)
                        {
                            caster = ch as Character;
                        }
                    }
                }
                if (finished)
                {
                    ObjectFactory.Recycle(gameObject);
                }
            }
        }
コード例 #4
0
ファイル: HitResponse.cs プロジェクト: DrMikeCooper/RPG
 public override void Apply(Prop ch, Character caster = null)
 {
     ch.hitResponses.Add(this);
 }
コード例 #5
0
ファイル: HitResponse.cs プロジェクト: DrMikeCooper/RPG
 public void PlayEffect(Prop p)
 {
     responseFX.Begin(p.GetBodyPart(responseBodyPart), tint);
 }
コード例 #6
0
 void Update()
 {
     Prop.UpdateProps();
 }
コード例 #7
0
        // death things
        IEnumerator DeathFade(Prop p, float time)
        {
            yield return(new WaitForSeconds(time));

            p.gameObject.SetActive(false);
        }