Наследование: MonoBehaviour
Пример #1
0
 void Awake()
 {
     agent = GetComponent <MoveSprite>();
     InvokeRepeating("UpdateTarget", 0.0f, 0.1f);
     attackCool = 0;
     leashPos   = transform.position;
 }
Пример #2
0
        private void animationPreview_SpriteDragComplete(object sender, EventArgs e)
        {
            var args = e as SpriteDragArgs;
            var mod  = new MoveSprite(frameSprites, frameSpriteListBox, args.DragDistance);

            mod.Undo();
            DoModification(mod);
        }
Пример #3
0
    void init()
    {
        //isKeyPress = false;
        fectorTime   = 1.5f;
        CustomButton = this.transform.Find("CustomButton").GetComponent <ButtonOnPress>();
        CustomButton.AddListener((int)BUTTON_STATE.BTNCUSTOM, PvpBtnOnPress);
        CustomButton.transform.localScale = new Vector3(0.8f, 0.8f, 0.8f);
//		TweenColor.Begin (CustomButton.gameObject,0f,Color.black);
//		TweenColor.Begin (CustomButton.gameObject,1f,Color.white);
//		UICommonMethod.TweenAlphaBegin (CustomButton.gameObject,0.2f,0,UITweener.Style.Once);
//		MoveSprite scaleAlpha = new MoveSprite ();
        //scaleAlpha.CustonScaleAlpha (CustomButton.gameObject,0.5f,1f,0.6f);
        BtnModeSelect = this.transform.Find("ModeSelect");
        MoneyLabel    = new UILabel[BtnModeSelect.childCount];
        BtnMove       = new ButtonOnPress[BtnModeSelect.childCount];
        SpriteBg      = new UISprite[BtnModeSelect.childCount];
        for (int i = 0; i < BtnModeSelect.childCount; i++)
        {
            BtnMove[i] = BtnModeSelect.Find(modeName[i]).GetComponent <ButtonOnPress>();
            BtnMove[i].AddListener(i + 1, PvpBtnOnPress);
            MoneyLabel[i]      = BtnMove[i].transform.Find("bBar/num").GetComponent <UILabel>();
            MoneyLabel[i].text = "55";
            SpriteBg[i]        = BtnMove[i].transform.Find("pane").GetComponent <UISprite>();
            SpriteBg[i].gameObject.SetActive(false);
        }
        ButtonOnPress tep = BtnMove [2];

        BtnMove [2] = BtnMove [1];
        BtnMove [1] = tep;
        int   index = -1210;      //X偏移值
        float time  = 0.08f;

        for (int i = 0; i < BtnModeSelect.childCount; i++, index += Interval)
        {
            MoveSprite ms = new MoveSprite();
            ms.SetMoveState(time, BtnMove[i].gameObject, duringTime[i], new Vector3(index - 20 + (i * 10), 0, 0));
        }
        //FriendButton = this.transform.FindChild("Training/FriendsListBtn").GetComponent<ButtonOnPress>();
        MatteBg       = this.transform.Find("Matte/Sprite").GetComponent <UISprite>();
        EffectLine    = this.transform.Find("pvp_line/flash").gameObject;
        GradualChange = this.transform.Find("Training").GetComponent <UISlider>();
        ChangeDate    = GradualChange.transform.Find("BottomBar").GetComponent <UISprite>();
        BtnGuide      = this.transform.Find("Training/Button");
        for (int i = 0; i < BtnGuide.childCount; i++)
        {
            ButtonOnPress btn = BtnGuide.Find("Guide" + (i + 1)).GetComponent <ButtonOnPress>();
            btn.AddListener(i + 4, PvpBtnOnPress);
        }
        BtnCancel        = this.transform.Find("Time/button").GetComponent <ButtonOnPress>();
        CountDownTime    = this.transform.Find("Time/Time").GetComponent <UILabel>();
        MatchNumber      = this.transform.Find("Time/Num").GetComponent <UILabel>();
        MatchNumber.text = "(1/6)";
        BtnCancel.AddListener((int)BUTTON_STATE.BTN_CANCEL, PvpBtnOnPress);
        BtnCancel.transform.parent.gameObject.SetActive(false);
        //FriendButton.AddListener((int)BUTTON_STATE.BTN_FRIENDLIST, PvpBtnOnPress);
    }
Пример #4
0
 void Start()
 {
     defaultScale = transform.localScale;
     GetComponent <Rigidbody2D>().centerOfMass = centerOfMass.localPosition;
     boatPortLevelEnd = FindObjectOfType <EndOfLevel>().transform.parent.GetComponent <MoveSprite>(); // HELP: how do we ignore this line when in the menu?
     GameManager.npcPointsSystem.OnPointsChanged += NpcPointsSystem_OnPointsChanged;
     peopleOnBoat = GameManager.npcPointsSystem.currentPoints;
     if (peopleCountBar != null)
     {
         peopleCountBar.SetVelocity(peopleOnBoat);
     }
 }
Пример #5
0
        //Awake is always called before any Start functions
        void Awake()
        {
            // grab each component
            trigger1 = triggerObject1.GetComponent <Collider1>();
            trigger2 = triggerObject2.GetComponent <Collider2>();
            trigger3 = triggerObject3.GetComponent <Collider3>();

            playerx    = player.GetComponent <PartyGoer>();
            moveSprite = player.GetComponent <MoveSprite>();
            for (int num = 0; num < enemies.Count; num++)
            {
                enemix.Add(enemies[num].GetComponent <PartyGoer>());
                enemovement.Add(enemies[num].GetComponent <MoveSprite>());
            }

            //Check if instance already exists
            if (instance == null)
            {
                //if not, set instance to this
                instance = this;
            }

            //If instance already exists and it's not this:
            else if (instance != this)
            {
                //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a GameManager.
                Destroy(gameObject);
            }

            //Sets this to not be destroyed when reloading scene
            //DontDestroyOnLoad(gameObject);

            //Get a component reference to the attached BoardManager script
            //boardScript = GetComponent<BoardManager2>();

            //Call the InitGame function to initialize the first level
            InitGame();
            stress_visual.value = stress;
            time_count.text     = "Time:" + hours + ": 0" + minutes + " pm";
        }
Пример #6
0
 void Start()
 {
     health = maxHealth;
     agent  = GetComponent <MoveSprite>();
     part   = GetComponent <ParticleSystem>();
 }