Supposing all your scripts are already attached to the same player object, the player object can be accessed using gameObject
in any of the script.
From there, you can call GetComponent<script class>
to get the instance of another script.
For instance:
public class TakeDMG
{
//if event happens then :
public void SomeEvent()
{
var p = gameObject.GetComponent<Player>();
p.minusHP();
}
}
Note that there is room for optimisation. This "search" for GetComponent can be done only once per script at startup, using a field.
public class TakeDMG
{
Player player; // private field to store the reference to Player script;
public Start()
{
player = gameObject.GetComponent<Player>();
}
//if event happens then :
public void SomeEvent()
{
player.minusHP();
}
}
Of course this can be done only of Player script is attached from the beginning to the player object, I think that's probably the case.
If you must repeat same code on many scripts (get the player instance), you can use inheritance to "factor out" the identical code.
public class PlayerScript
{
protected Player player; // field to store the reference to Player script;
public virtual Start()
{
player = gameObject.GetComponent<Player>();
}
}
// This scripts inherit from PlayerScript
public class TakeDMG : PlayerScript
{
//if event happens then :
public void SomeEvent()
{
player.minusHP();
}
}
// This one as well
public class AnotherScript : PlayerScript
{
//if event happens then :
public void SomeOtherEvent()
{
player.minusHP();
}
}