Пример #1
0
    // Use this for initialization
    void Start()
    {
        var ctrl = Character.ControlObject.getControl();

        ctrl.addObject(this);

        var obj = Resources.Load <GameObject>("Player");

        m_chobj      = GameObject.Instantiate <GameObject>(obj);
        m_chobj.name = "PlayerObject";
        m_chobj.transform.SetParent(gameObject.transform, false);
        m_position = new Vector2(24, 128);

        m_hit = new Character.Hit();
        m_hit.setSize(new Vector2(16, 16));
        m_hit.setOffset(new Vector2(-8, 8));

        m_animator   = m_chobj.GetComponent <Animator>();
        m_animSprite = m_chobj.GetComponent <SpriteRenderer>();

        type = CharacterObjectBase.Type.Player;

        m_stageObj = GameObject.Find("Stage");
        if (m_stageObj == null)
        {
            Debug.Log("ステージオブジェクトが無い");
        }
    }
Пример #2
0
    // Use this for initialization
    void Start()
    {
        var ctrl = Character.ControlObject.getControl();

        ctrl.addObject(this);

        var obj = Resources.Load <GameObject>("Enemy");

        m_chobj      = GameObject.Instantiate <GameObject>(obj);
        m_chobj.name = "EnemyObject";
        m_chobj.transform.SetParent(gameObject.transform, false);

        m_hit = new Character.Hit();
        m_hit.setSize(new Vector2(1f, 1f));
        m_hit.setOffset(new Vector2(-0.5f, 0.5f));

        type = CharacterObjectBase.Type.Enemy;
    }