Example #1
0
 public override bool init(EntityPlayer entity)
 {
     base.init(entity);
     entity.GetComponent <Rigidbody>().AddForce(entity.transform.rotation * forceApplied, ForceMode.Impulse);
     m_rigidBody = entity.GetComponent <Rigidbody>();
     if (m_collider != null)
     {
         m_collider.gameObject.SetActive(true);
     }
     return(true);
 }
    protected override void OnPurchase(EntityPlayer player)
    {
        Destroy(player.GetComponent <PlayerAttack>());
        PlayerAttackMelee pam = player.gameObject.AddComponent <PlayerAttackMelee>();

        pam.damage          = this.damage;
        pam.attackAnimation = this.attackAnimation;
    }
Example #3
0
    public override void onObjectEnter(Rigidbody body, EntityPlayer entity, Vector3 impactPoint)
    {
        base.onObjectEnter(body, entity, impactPoint);
        float damage = Mathf.Max(m_damageMin, m_damage * (radius - (this.transform.position - impactPoint).magnitude) / radius);

        if (entity != null)
        {
            var player = entity.GetComponent <Player>();
            if (player != null)
            {
                player.RpcAddExplosionForce(force, this.transform.position - player.transform.position, radius, uplift, ForceMode.Impulse);
                if (entity.takeDamage(damage / 2))
                {
                    entity.TargetTakeDamage(entity.connectionToClient, entity.transform.position, damage / 2);
                }
                return;
            }
            else
            {
                entity.takeDamage(damage);
            }

            //if (player.hasAuthority) return;
        }

        if (body != null)
        {
            var networkBody = body.GetComponent <NetworkRigidbody>();
            if (networkBody != null)
            {
                networkBody.RpcAddExplosionForce(force, this.transform.position - networkBody.transform.position, radius, uplift, ForceMode.Impulse);
                return;
            }
        }

        //body.AddExplosionForce(force,this.transform.position,radius,uplift, ForceMode.Impulse);
    }
Example #4
0
 public override void Activate(EntityPlayer player) => player.GetComponent <PlayerDepthTransition>().TransferDown(tilePos, transform.position);