コード例 #1
0
    private void OnCollisionEnter(Collision collision)
    {
        Infectable infectable = collision.gameObject.GetComponent <Infectable>();

        if (infectable != null)
        {
            infectable.ValidateInfectioPlayer(this);
        }

        Player hitPlayer = collision.gameObject.GetComponent <Player>();

        if (hitPlayer != null)
        {
            lastHitPlayer = hitPlayer;
            timeHitPLayer = Time.time;
        }
    }
コード例 #2
0
ファイル: Infectable.cs プロジェクト: kindingerlek/GGJ2018
    public void ValidateInfectioNpc(Infectable infectable)
    {
        if (infectable == null)
        {
            return;
        }

        var i1 = infectedBy == null ? 0 : infectedBy.playerIndex;
        var i2 = infectable.infectedBy == null ? 0 : infectable.infectedBy.playerIndex;

        RuleManager.collisionType infectRes = RuleManager.Instance.CompareInfectation(i1, i2);
        if (infectRes == RuleManager.collisionType.MeInfectOther)
        {
            Debug.Log(this.name + ": I infect " + infectable.name);
            infectable.Infect(infectedBy);
        }
        else if (infectRes == RuleManager.collisionType.OtherInfectMe)
        {
            Debug.Log(this.name + ": I was infected by " + infectable.name);
            Infect(infectable.infectedBy);
        }
    }
コード例 #3
0
ファイル: Infectable.cs プロジェクト: kindingerlek/GGJ2018
    private void OnCollisionEnter(Collision collision)
    {
        Infectable infectable = collision.gameObject.GetComponent <Infectable>();

        ValidateInfectioNpc(infectable);
    }