Ejemplo n.º 1
0
        public CharacterRenderer(ServerPlayer player)
        {
            m_player = player;
            m_characterRenderer = m_player.GetComponent<SpriteRenderer>();
            m_animator = m_player.GetComponent<Animator>();

            normalMaterial = (Material)Resources.Load("Materials/Player/Normal", typeof(Material));
            effectMaterials = (MaterialSet)Resources.Load("Materials/Player/effects", typeof(MaterialSet));
        }
Ejemplo n.º 2
0
    protected override void OnCollideToPlayer(ServerPlayer character, Vector2 point)
    {
        //When Hit My Player
        if (character)
        {
            if (owner == character.GetOwner())
                return;

            if (character.IsDead())
                return;

            character.Damage(damage, new NetworkMessageInfo());
            ImpactTarget(character.GetComponent<Rigidbody2D>(), impact);

            DestroyFromNetwork();
        }
    }
Ejemplo n.º 3
0
    public virtual void Init(ServerPlayer player, WeaponInfo weapon, FireInfo info)
    {
        owner = player.GetOwner();
        direction = info.direction;
        GetComponent<Rigidbody2D>().AddForce(direction * GetPower(weapon), ForceMode2D.Impulse);

        long projID = ProjectileManager.Inst.GetUniqueKeyForNewProjectile();
        ProjectileManager.Inst.Set(projID, this);

        Physics2D.IgnoreCollision(collider, player.GetComponent<Collider2D>());

        OnInit();
        BroadcastInit();
    }
Ejemplo n.º 4
0
    void ConnectToOwner()
    {
        ownerPlayer = PlayerManager.Inst.Get(owner);
        ropeSource = PlayerManager.Inst.Get(owner);

        ropeSJ = gameObject.AddComponent<SpringJoint2D>();
        ropeSJ.connectedBody = ownerPlayer.GetComponent<Rigidbody2D>();
        ropeSJ.distance = 5f;
        ropeSJ.frequency = 2;
        ropeSJ.dampingRatio = 1;

        ownerPlayer.RopeFired(this);
    }