示例#1
0
    public override void Init()
    {
        base.Init();

        Sprite[] sprites = Resources.LoadAll <Sprite>("Sprites/Menus/Bars");
        energyBarEmpty = sprites[0];
        energyBarFull  = sprites[62];
        sprites        = Resources.LoadAll <Sprite>("Sprites/Menus/WeaponIcons");
        weaponIcon     = sprites[62 * 2];
        weaponIconGray = sprites[62 * 2 + 1];

        coilPrefab = ((GameObject)Resources.Load("Prefabs/PlayerWeapons/RushCoil", typeof(GameObject))).GetComponent <PlWp_RushCoil>();
    }
示例#2
0
    public override void Press()
    {
        if (coil == null)
        {
            RaycastHit2D hit;
            Vector3      targetPos = owner.transform.position + owner.right * 32f;
            if (hit = Physics2D.Raycast(targetPos, -owner.up, 128f, 1 << 8))
            {
                targetPos = hit.point;
            }


            coil = Object.Instantiate(coilPrefab);
            coil.transform.position   = targetPos;
            coil.transform.localScale = owner.anim.transform.localScale;
            waitingForContact         = true;
        }
        else
        {
            base.Press();
        }
    }