HitByExplotion() public method

public HitByExplotion ( int playerIndex, Vector2 pos ) : void
playerIndex int
pos Vector2
return void
コード例 #1
0
ファイル: MoveController.cs プロジェクト: Grutn/TDT4240-X2
        private bool ExplodeHit(Fixture explotionFixture, Fixture characterFixture, Contact list)
        {
            CharacterController character = (CharacterController)characterFixture.Body.UserData;

            character.model.damagePoints += 5;
            Explotion explotion    = (Explotion)explotionFixture.Body.UserData;
            Vector2   pos          = explotion.Img.CurrentPos + explotion.Img.Origin;
            Vector2   velocityPlus = character.view.Position - pos;

            velocityPlus.Normalize();
            velocityPlus            *= new Vector2(5, 5);
            character.view.Velocity += velocityPlus;
            character.HitByExplotion(explotion.PlayerIndex, pos);
            return(false);
        }