示例#1
0
    void OnTriggerEnter(Collider other)
    {
        if (entered || other.tag != "Player")
        {
            return;
        }
        entered = true;
        PlatformerPhysics phys = other.gameObject.GetComponent <PlatformerPhysics>();
        grimInfo          info = other.gameObject.GetComponent <grimInfo>();

        if (info.soulCount + info.maskDifference < 0)          // good
        {
            phys.hasEvilAttack = false;
            phys.hasGoodAttack = true;
            Instantiate(goodSkully, location, Quaternion.Euler(new Vector3(0, 0, 0)));
            PlayerPrefs.SetInt("evilAttack", 0);
            PlayerPrefs.SetInt("goodAttack", 1);
        }
        else                             // bad
        {
            phys.hasEvilAttack = true;
            phys.hasGoodAttack = false;
            Instantiate(badSkully, location, Quaternion.Euler(new Vector3(0, 0, 0)));
            PlayerPrefs.SetInt("evilAttack", 1);
            PlayerPrefs.SetInt("goodAttack", 0);
        }
    }
示例#2
0
    private AnimSounds sounds;            // Reference to sound controller.

    void Awake()
    {
        // Setting up the references.
        player   = GameObject.FindGameObjectWithTag("Player");
        griminfo = player.GetComponent <grimInfo>();
        sounds   = player.GetComponent <AnimSounds>();
    }
示例#3
0
    void Start()
    {
        player = GameObject.FindGameObjectWithTag("Player");
        print(player);
        griminfo = player.GetComponent <grimInfo> ();

        xSize = 456f;
        ySize = 66f;

        healthPosition = new Vector2(0, 0);
        healthSize     = new Vector2(xSize, ySize);

        keyPosition = new Vector2(Screen.width - xSize, 0);
        keySize     = new Vector2(xSize, ySize);

        moralitySize     = new Vector2(xSize, ySize);
        moralityPosition = new Vector2((Screen.width - xSize) / 2, Screen.height - ySize);

        iconSize    = new Vector2(xSize / 45f, ySize);
        moralityBar = 0.5f;

        dashPosition = new Vector2(0, ySize);
        dashSize     = new Vector2(xSize / 2f, ySize / 2f);

        ultimatePosition = new Vector2(xSize / 2f, ySize);
        ultimateSize     = new Vector2(xSize / 2f, ySize / 2f);
    }
示例#4
0
    public void Start()
    {
        //do some checks to make sure we have the required components
        if (!rigidbody)
        {
            Debug.LogError("The PlatformerPhysics component requires a rigidbody.");
            enabled = false;
        }

        if (!collider || collider.GetType() != typeof(BoxCollider))
        {
            Debug.LogError("The PlatformerPhysics component requires a box collider.");
            enabled = false;
        }

        if (rigidbody.useGravity)
        {
            Debug.LogWarning("You should turn off 'use gravity' on the platformer rigidbody. This will give strange behaviour.");
        }

        combatComponent = GetComponent <PlayerCombat>();
        infoComponent   = GetComponent <grimInfo> ();

        mStartPosition = transform.position;
        RecalcBounds();
        origColliderCenterY = ((BoxCollider)collider).center.y;
        origColliderSizeY   = ((BoxCollider)collider).size.y;
    }
示例#5
0
    public void destroySoul()
    {
        GameObject player    = GameObject.FindGameObjectWithTag("Player");
        grimInfo   grim_info = player.GetComponent <grimInfo> ();

        grim_info.soulCount += 1;
        Destroy(this.gameObject);

        Instantiate(soulKilled, transform.position, Quaternion.Euler(new Vector3(0, 0, 0)));
    }
示例#6
0
    void OnTriggerEnter(Collider other)
    {
        PlatformerController controller = other.gameObject.GetComponent <PlatformerController>();
        PlayerCombat         combat     = other.GetComponent <PlayerCombat>();
        grimInfo             info       = other.GetComponent <grimInfo> ();
        int spikeDamage = 1;

        if (controller && controller.HasControl())
        {
            info.Damage(spikeDamage);
        }
    }
示例#7
0
    // Use this for initialization
    void Awake()
    {
        player = GameObject.FindGameObjectWithTag("Player");
        info   = player.GetComponent <grimInfo>();

        offset = Vector3.up;
        pos1   = transform.position;
        pos2   = transform.position + offset;

        if (info.good)
        {
            lifetime = 10;
        }
        StartCoroutine(killNow(lifetime));
    }
示例#8
0
    void WinMessage()
    {
        if (!done)
        {
            done = true;
            grimInfo info = GameObject.FindGameObjectWithTag("Player").GetComponent <grimInfo> ();
            if (info.soulCount < 0)                       // good
            {
                Instantiate(goodSkully, location, Quaternion.Euler(new Vector3(0, 0, 0)));
            }
            else                         // bad

            {
                Instantiate(badSkully, location, Quaternion.Euler(new Vector3(0, 0, 0)));
            }
        }
    }
示例#9
0
    void OnTriggerEnter(Collider other)
    {
        if (entered || other.tag != "Player")
        {
            return;
        }
        entered = true;
        PlatformerPhysics phys = other.gameObject.GetComponent <PlatformerPhysics>();
        grimInfo          info = other.gameObject.GetComponent <grimInfo>();

        if (info.soulCount + info.maskDifference < 0)          // good
        {
            PlayerPrefs.SetFloat("soulCount", -0.5f);
            Instantiate(goodSkully, location, Quaternion.Euler(new Vector3(0, 0, 0)));
        }
        else             // bad
        {
            PlayerPrefs.SetFloat("soulCount", 0.5f);
            Instantiate(badSkully, location, Quaternion.Euler(new Vector3(0, 0, 0)));
        }
    }
示例#10
0
    void OnTriggerEnter(Collider other)
    {
        if (entered || other.name != "Player")
        {
            return;
        }
        entered = true;
        StartCoroutine(DisplayText());
        PlatformerPhysics phys = other.gameObject.GetComponent <PlatformerPhysics>();
        grimInfo          info = other.gameObject.GetComponent <grimInfo>();

        if (info.soulCount < 0)           // good
        {
            phys.hasEvilAttack = false;
            phys.hasGoodAttack = true;
        }
        else             // bad
        {
            phys.hasEvilAttack = true;
            phys.hasGoodAttack = false;
        }
    }