コード例 #1
0
        void    TargetInflictedDamage(NetworkConnection conn, float damage, float timeToDisplay, float velocity)
        {
            if (!this.isLocalPlayer)
            {
                return;
            }

            var msg = new OnScreenMessage();

            msg.text = damage.ToString();

            Vector2 dir = Random.insideUnitCircle;

            msg.screenPos = new Vector2(0.5f, 0.5f) + dir * Random.Range(0f, 0.2f);

            msg.velocity = dir * velocity;

            msg.timeLeft = timeToDisplay;

            msg.color           = this.color;
            msg.backgroundColor = this.backgroundColor;

            OnScreenMessageManager.AddMessage(msg);
        }
コード例 #2
0
 void Awake()
 {
     singleton = this;
 }