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)); }
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(); } }
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(); }
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); }